In: Computer Science
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.
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.
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.
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.
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.
Define a function that prompts the user to enter a score grading code. Be sure to know what values are expected.
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.
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.
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.
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.
Execute your code for two different students who received different scores. Evaluate the values printed to screen and update your code as needed.
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))