Question

In: Computer Science

dont use loops for it and each problem solving process needs a seperate statement within a...

dont use loops for it and each problem solving process needs a seperate statement within a function. also create a range for each of the functions to limit input to the max points for each section. also make a dictionary to associate names with student id and hard code some examples in there to return string with students name, their id number, total score, and lab number

using python You will be writing a program that can be used to sum up and report lab scores. Your program must allow a user to enter points values for the four parts of the problem solving process (0-5 points for each step), the code (0-20 points), and 3 partner ratings (0-10) points each. It should sum the points for each problem-solving step, the code, and the average of the three partner ratings and print out a string reporting the student’s information, points earned, and lab number. Each function referred to below must be implemented and have an appropriate docstring. Please work in order of the steps listed below.


  1. Define the function called grade_lab that takes in the lab number and student id as parameters. Have it return a string in the form “Student: XXX earned 50 points on lab Y”. You may start by assuming all students earn 50 points.

  2. Call the function with student id 12345 and for lab 3 and print the string it returns to the screen. Evaluate whether or not it is correct, and whether it could be improved (e.g, with spacing and formatting). Call again with different values and re-evaluate.

  3. Define a function for grading parts of the problem solving process that takes the problem-solving step number (1-4) as a parameter, and prompts the user with a detailed message to enter the score for the giving problem-solving set (e.g., “Please enter a score 0 - 5 earned for understanding the problem: ”). The prompt must be specific to the step number entered.

  4. In the grade_lab function, call the function for grading parts of the problem solving process and replace the 50 point value (referred to in step 1) with the score returned. Then, call the function for steps 2 - 4, and print the total of all scores.

  5. Define a function that prompts the user to enter a score grading code. Be sure to know what values are expected.

  6. In the grade lab function, call the function for grading code and add its value to the total score reported. Test your code to make sure the total score is being calculated correctly.

  7. Define a function that prompts the user to enter 3 partner rating scores (be sure to include expected values) and returns the average of those scores.

  8. In the grade lab function, call the function for getting partner ratings and it to the total score reported. Test this partner function with at least the following values: 10, 10, 10; and then 0, 5, 10. Evaluate whether or not the function is working correctly.

  9. Update your grade_lab function to store names associated with various student ids. Hard code some example id numbers and student names. Update the string returned to include the student name along with their id number.  

  10. Execute your code for two different students who received different scores. Evaluate the values printed to screen and update your code as needed.

Solutions

Expert Solution

You mentioned to not use for loops, so I've done all of the working recursively.

def lab_grade(num,sid):
    val = prob_solve(1)
    val+= prob_solve(2)
    val+= prob_solve(3)
    val+= prob_solve(4)
    val+= code()
    val+=(part_rate(1)/3)
    names = {
        '123' : 'John',
        '1234' : 'Sam',
        '12345' : 'Jacob'
    }
    return names[str(sid)]+" (ID:"+str(sid)+") earned "+str(val)+" points on lab "+str(num)

def code():
    val = input("Please enter a score 0 - 20 for coding: ")
    val = int(val)
    print()
    if val>20 or val<0:
        print("Score must be between 0 and 5\n")
        return code()
    return val

def part_rate(n):
    if n == 4:
        return 0
    val = input("Please enter a score 0 - 10 for partner {0}'s rating: ".format(n))
    val = int(val)
    print()
    if val>10 or val<0:
        print("Score must be between 0 and 10\n")
        return part_rate(n)
    val+=part_rate(n+1)
    return val
   
def prob_solve(num):
    if num ==1:
         val = input("Please enter a score 0 - 5 earned for understanding the problem: ")
    if num==2:
        val = input("Please enter a score 0 - 5 earned for devising a plan: ")
    if num==3:
        val = input("Please enter a score 0 - 5 earned for carrying out the plan: ")
    if num==4:
         val = input("Please enter a score 0 - 5 earned for looking back and checking: ")
    val = int(val)
    print()
    if val>5 or val<0:
        print("Score must be between 0 and 5\n")
        return prob_solve(num)
    return val
print(lab_grade(1,12345))

Related Solutions

Solve the following using Polya’s four-step problem-solving process. Use the strategy “Direct Reasoning” to solve the...
Solve the following using Polya’s four-step problem-solving process. Use the strategy “Direct Reasoning” to solve the problem. Show all work and clearly describe your thought process. julia, william, kelly, and mary each entered a dog in a dog jumping contest. there frogs were named hippy, happy, bounce, and pounce. – placed first, second, or third in the contest and earned a blue, red or white ribbon respectively. Use the following clues to determine who entered which frog and the order...
The toughest part of the problem-solving process is _____. Question 2 options: clarifying the problem identifying...
The toughest part of the problem-solving process is _____. Question 2 options: clarifying the problem identifying the problem that you want to work on selecting your best option generating multiple solutions Question 3 (1 point) Although a _____ allows managers to take the business concept beyond the idea stage, it doesn't accomplish the actual work. Question 3 options: plan vision mission goal Question 4 (1 point) Long-range planning that establishes an overall course of action for a company is generally...
Assignment problem. Give a small example of an assignment problem statement. Outline an algorithm for solving...
Assignment problem. Give a small example of an assignment problem statement. Outline an algorithm for solving the assignment problem. Is your algorithm polynomial? Explain.
THE NOT REPLACE PROBLEM Must use loops. Please do not use sequence of if statements. I...
THE NOT REPLACE PROBLEM Must use loops. Please do not use sequence of if statements. I need it in C++. Given an input string, set result to a string where every appearance of the lowercase word "is" has been replaced with "is not". The word "is" should not be immediately preceded or followed by a letter -- so for example the "is" in "this" does not count.   • for input of "is test" → "is not test" • for input...
IN JAVA USING loops, Arrays, filewriter/reader/exceptions, I dont think we are allowed to use arraylists/algorithm constraints...
IN JAVA USING loops, Arrays, filewriter/reader/exceptions, I dont think we are allowed to use arraylists/algorithm constraints THE TWO FILES ARE LISTED AFTER THE QUESTION(CDDriver.java and TextMenu.java) Lab 14 Array of Objects and File IO The following exercises are to be completed during lab class. If you do not have time to finish during lab, they must be completed before the beginning of the following lab session. Set-Up  Import the following file (See below) o CDDriver.java o TextMenu.java Import the...
Use R.  Provide Solution and R Code within each problem. For this section use the dataset “PlantGrowth”,...
Use R.  Provide Solution and R Code within each problem. For this section use the dataset “PlantGrowth”, available in base R (you do not need to download any packages). a.Construct a 95% confidence interval for the true mean weight. b.Interpret the confidence interval in 1. in the context of the problem. c.Write down the null and alternative hypothesis to determine if the mean weight of the plants is less than 5. d.Conduct a statistical test to determine if the mean weight...
THE STRING MATCH PROBLEM C++ only. Must use loops. Please do not use sequence of if...
THE STRING MATCH PROBLEM C++ only. Must use loops. Please do not use sequence of if statements. . Given 2 strings, a and b, set result to the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings. • for input of "xxcaazz", "xxbaaz" → 3 • for input of "abc", "abc" → 2 • for input...
You are in the process of solving a basic price optimization problem to determine what price...
You are in the process of solving a basic price optimization problem to determine what price to charge for a product in order to maximize contribution. Your demand is exponential and its function is D(p) = 20000 * p^-2 and the incremental cost is $15. A. what is your objective function? B. you have solved a basic price optimization model and determined that your original contribution is $333.33 and you will sell to 22.22 customers. What is your optimal price?...
It is important to understand the 3 first stages of the creative problem solving process. Problems...
It is important to understand the 3 first stages of the creative problem solving process. Problems may be obvious. If they're not, they can often be identified using the trigger questions in each of the problem solving stage. Read the attached memo about Google, the tech giant’s diversity initiatives and “ideological echo chamber,” written by an anonymous Google Engineer. The document was circulated throughout the company’s ranks and became viral this summer. Google Ideological Echo Chamber.pdf. The document cited principles...
What four purposes are served by clarifying objectives early in problem-solving process?
What four purposes are served by clarifying objectives early in problem-solving process?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT