
Untitled
By: a guest on
May 10th, 2012 | syntax:
Python | size: 0.47 KB | hits: 22 | expires: Never
#!/usr/bin/python
# P2PU - Python Programming 101 - Chapter 6 - Flow Control
# Python for Informatics - Chapter 3 - Conditional Execution
# Exercise 3.3
print '\n# Exercise 3.3\n'
try:
num = float(raw_input('Enter a number between 0.0 and 1.0: '))
if num < 0.0 or num > 1.0 : print 'Bad score!'
elif num >= 0.9 : print 'A'
elif num >= 0.8 : print 'B'
elif num >= 0.7 : print 'C'
elif num >= 0.6 : print 'D'
else : print 'F'
except:
print 'Bad score!'