""" A certain CS professor gives 5-point quizzes that are graded on the scale 5-A, 4-B, 3-C, 2-D, 1-F, 0-F. Write a program that defines a quiz score variable and prints out the letter grade. If the score is invalid, print out a message saying: Invalid Score. """ score = 5 if score == 5: grade = 'A' elif score == 4: grade = 'B' elif score == 3: grade = 'C' elif score == 2: grade = 'D' elif score == 1 or score == 0: grade = 'F' result = "You received an {0} on this quiz".format(grade) print result else: result = "Invalid Score" print result
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