# Assignment 5 exercise 7 # Calculates the average grade # Cory Parker 4/30/15 #fuctions to call def calcAverage(all_scores): calcAverage = (all_scores) / 5 return calcAverage def determineGrade(): if (calcAverage(all_scores)>89): return ("A") elif (calcAverage(all_scores)>79 and calcAverage(all_scores)<90): return ("B") elif (calcAverage(all_scores)>69 and calcAverage(all_scores)<80): return ("C") elif (calcAverage(all_scores)>59 and calcAverage(all_scores)<70): return ("D") elif (calcAverage(all_scores)<60): return ("F") #Ask the student for test scores S1 = input('Enter the first test score: ') print(S1) S2 = input('Enter the Second test score: ') print(S2) S3 = input('Enter the Third test score: ') print(S3) S4 = input('Enter the Fourth test score: ') print(S4) S5 = input('Enter the Fifth test score: ') print(S5) all_scores = (S1 + S2 + S3 + S4 + S5) #Tell student average score and letter grade print '\nThe average score is {} and your grade letter is {}'.format(calcAverage(all_scores), determineGrade()) #Tell student if they passed if calcAverage(all_scores) > 60: print('Congradulations you passed') else: print('You did not pass')
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question