Question
#phyton ''' Please help me to solve this error. Error: Traceback (most recent call last): File /Users/mdhossain/Desktop/p4.py, line 91, in main() File /Users/mdhossain/Desktop/p4.py, line 83,
#phyton
''' Please help me to solve this error. Error: Traceback (most recent call last): File "/Users/mdhossain/Desktop/p4.py", line 91, in
def get_scores():
#Ask user to input x = int(input('Enter 1st posative number: ')) #check valid number while x < 0: print('invalid input! Must be posative') x = int(input('Enter 1st posative number: ')) break
#Ask user to input y = int(input('Enter 3rd posative number: ')) #check valid number while y < 0: print('invalid input! Must be posative') y = int(input('Enter 1st posative number: ')) break
#Ask user to input z = int(input('Enter 3ed posative number: ')) #check valid number while z < 0: print('invalid input! Must be posative') z = int(input('Enter 3rd posative number: ')) # it will return xyz return x, y, z break
def calculate_average(score1, score2, score3):
#get avg value return (score1 + score2 + score3) / 3
#grade
def assign_grade(score):
if (score >= 90):
return 'A'
elif (score >= 80 and score < 90):
return 'B'
elif (score >= 70 and score < 80):
return 'C'
elif (score >= 60 and score < 70):
return 'D'
else:
return 'F'
def show_results(num, letterGrade):
print("Average score:", num)
print("Assigned letter grade:", letterGrade)
def main():
(x, y, z) = get_scores()
avgScore = calculate_average(score1, score2, score3)
letterGrade = assign_grade(avgScore)
show_results(avgScore, letterGrade)
main()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started