Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Logan Dawson, 10/16/2018, This is a rework of Assignment 8 with Iteration."""
- #I start by putting my if/else statements inside my function
- def computegrade(Grade):
- if Grade>=0.9 and Grade<=1.0:
- print("A")
- elif Grade>=0.8 and Grade<=0.89:
- print("B")
- elif Grade>=0.7 and Grade<=0.79:
- print("C")
- elif Grade>=0.6 and Grade<=0.69:
- print("D")
- elif Grade>=0.0 and Grade<=0.6:
- print("F")
- else:
- print ("Bad Score")
- return Grade
- # I then set up my loop
- while True:
- #This is where I'm struggling to make it work.
- Score
- try:
- Score=float(input("Enter Score or type 'quit' to exit: "))
- except:
- print("Bad Score")
- computegrade(Score)
- if Score == 'quit':
- break
- print("Thanks for using the grade calculation program!")
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement