#Josh Roybal #CIS 122 #Chapter 6 Programming Exercise #7 def calcAverage(score1, score2, score3, score4, score5): print("Calculating... \n") average = (score1 + score2 + score3 + score4 + score5) / 5 print('The average of the test scores is', average, '. \n') determineGrade(average) def determineGrade(testScore): if testScore <= 100 and testScore >= 90: print('A. \n') elif testScore <= 89 and testScore >= 80: print('B. \n') elif testScore <= 79 and testScore >= 70: print('C. \n') elif testScore <= 69 and testScore >= 60: print('D. \n') else: print('F. \n') def main(): score1 = int(input("Please enter the first test score: ")) print('\n') determineGrade(score1) score2 = int(input("Please enter the second test score: ")) print('\n') determineGrade(score2) score3 = int(input("Please enter the third test score: ")) print('\n') determineGrade(score3) score4 = int(input("Please enter the fourth test score: ")) print('\n') determineGrade(score4) score5 = int(input("Please enter the fifth test score: ")) print('\n') determineGrade(score5) calcAverage(score1, score2, score3, score4, score5) main()
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