def calcAverage(one,two,three,four,five): #define calcAverage sum = (one + two + three + four + five) / 5 print "The average test score grade is: " + str(sum) + "%." def determineGrade(sum2): #define determineGrade sum2= (one + two + three + four + five) / 5 if sum2 >= 90: print "Your final grade is an A." if sum2 >= 80 and sum2 <= 90: print "Your final grade is a B." if sum2 >= 70 and sum2 <= 80: print "Your final grade is a C." if sum2 >= 60 and sum2 <= 70: print "Your final grade is a D." if sum2 < 60: print "Your final grade is an F." one = input("Please enter the first test score: ") #user input print one two = input("Please enter the second test score: ") print two three = input("Please enter the third test score: ") print three four = input("Please enter the fourth test score: ") print four five = input("Please enter the fifth test score: ") print five calcAverage(one,two,three,four,five) #carry out calcAverage determineGrade(sum) #carry out determineGrade
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