intTestScore = -1 strTestGrade = '' blnInputValidation = False while (blnInputValidation == False): intTestScore = input('Please enter the test score (0-100):') intTestScore = int(intTestScore) if (intTestScore >= 0 or intTestScore <=100): blnInputValidation = True break if (intTestScore > 89): strTestGrade = 'A' elif (intTestScore < 90 and intTestScore >= 80): strTestGrade = 'B' elif (intTestScore < 80 and intTestScore >= 70): strTestGrade = 'C' elif (intTestScore < 70 and intTestScore >= 60): strTestGrade = 'D' else: strTestGrade = 'F' if (strTestGrade == 'A' or strTestGrade == 'F'): print('You got an ' + strTestGrade + '.') else: print('You got a ' + strTestGrade + '.')
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