''' a=5 b=10 if a < b: print(a, "is smaller thant", b) elif a > b: print (a, " is bigger than ", b) else: print (a, "is equal to ",b) ''' def getGrade(): grade=-1 while grade < 0 or grade > 100: grade=int(input("Enter a grade between 0 and 100 ")) #if grade < 0 or grade > 100: #grade=-1 return grade def evaluateGrade(): g = getGrade() #if g == -1: #print ("Invalid Grade") #return if g > 90: print("you did great") elif g > 80: print(" you did good") elif g > 70: print("you passed") else: print("Sorry, you failed.") def main(): choice='y' while choice == 'y': evaluateGrade() choice=input("y to continue") choice.lower() main()
Monday, October 28, 2019
if and while blocks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment