Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Exercise 4.7
- def computescore(scr):
- if scr >= 0.9 :
- print 'Grade: A'
- elif scr >= 0.8 :
- print 'Grade: B'
- elif scr >= 0.7 :
- print 'Grade: C'
- elif scr >= 0.6 :
- print 'Grade: D'
- else:
- print 'Grade: F'
- try:
- scr = float(raw_input('Please enter a number between 0.0 and 1.0. \n'))
- if (scr > 1.0 or scr < 0.0):
- print 'Please enter a valid number.'
- quit()
- except:
- print 'Please enter a number.'
- quit()
- grade = computescore(scr)
- print grade
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement