Advertisement
Guest User

Untitled

a guest
May 10th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # P2PU - Python Programming 101 - Chapter 6 - Flow Control
  4. # Python for Informatics - Chapter 3 - Conditional Execution
  5. # Exercise 3.3
  6. print '\n# Exercise 3.3\n'
  7. try:
  8.     num = float(raw_input('Enter a number between 0.0 and 1.0: '))
  9.     if num < 0.0 or num > 1.0 : print 'Bad score!'
  10.     elif num >= 0.9 : print 'A'
  11.     elif num >= 0.8 : print 'B'
  12.     elif num >= 0.7 : print 'C'
  13.     elif num >= 0.6 : print 'D'
  14.     else : print 'F'
  15. except:
  16.   print 'Bad score!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement