Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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, which has the function near the top
- # I also define the value "Score"
- while True:
- Score=int
- if Score=='quit':
- print("Thanks for using the grade calculation program!")
- quit()
- computegrade(Score)
- try:
- Score=float(input("Enter score or type 'quit' to exit: "))
- except:
- print("Bad grade")
Advertisement
Add Comment
Please, Sign In to add comment