Advertisement
viking_the_red

Untitled

Oct 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. """Logan Dawson, 10/16/2018, This is a rework of Assignment 8 with Iteration."""
  2. #I start by putting my if/else statements inside my function
  3. def computegrade(Grade):
  4.   if Grade>=0.9 and Grade<=1.0:
  5.     print("A")
  6.   elif Grade>=0.8 and Grade<=0.89:
  7.     print("B")
  8.   elif Grade>=0.7 and Grade<=0.79:
  9.     print("C")
  10.   elif Grade>=0.6 and Grade<=0.69:
  11.     print("D")
  12.   elif Grade>=0.0 and Grade<=0.6:
  13.     print("F")
  14.   else:
  15.     print ("Bad Score")
  16.   return Grade
  17. # I then set up my loop
  18. while True:
  19. #This is where I'm struggling to make it work.
  20.   Score
  21.   try:
  22.     Score=float(input("Enter Score or type 'quit' to exit: "))
  23.   except:
  24.     print("Bad Score")
  25.   computegrade(Score)
  26.   if Score == 'quit':
  27.     break
  28. print("Thanks for using the grade calculation program!")
  29. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement