viking_the_red

Untitled

Oct 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 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.   Score=None
  20.   try:
  21.     Score=float(input("Enter score or type 'quit' to exit: ")
  22.   except:
  23.     print("Bad grade")
  24.   computegrade(Score)
  25. print("Thanks for using the grade calculation program!")
  26. quit()
Advertisement
Add Comment
Please, Sign In to add comment