Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Tue Mar 26 13:07:49 2013
- Exercise 4.7
- @author: casa
- """
- def computegrade(s):
- if s > 1 :
- g = 'None'
- elif s > 0.9 :
- g = 'A'
- elif s > 0.8 :
- g = 'B'
- elif s > 0.7 :
- g = 'C'
- elif s > 0.6 :
- g = 'D'
- else :
- g = 'F'
- return g
- while (True):
- score = raw_input("Enter score: ")
- if score == "done" :
- print("Bye bye")
- break
- try:
- print score
- score = float(score)
- grade = computegrade(score)
- except:
- print("Bad score")
- continue
- print("Grade: "), grade
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement