Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constant = 1
- firstrun = True
- def intro():
- print ""
- print "this program will tell you what grade you can"
- print "get on the final and still keep a certian letter grade."
- print ""
- def inter():
- print ""
- print "Do you want to calculate your grade again. (y,n)"
- def start():
- print ""
- print "What grade do you have in the class"
- grade = input( ">" ) # Getting the input of the grade
- grade2 = grade*0.8 # The final is worth 20% of your grade, thus the .8
- # The if else function here will tell you what score you can get on the final and
- # keep an A in the class. If the result is zero,
- # then you will get AT LEAST that grade
- print "For an A"
- if (89.55-grade2)/20<0:
- print ( "0" )
- else: print (((89.55-grade2)/20)*100)
- print "for a B"
- if (79.55-grade2)/20<0:
- print ( "0" )
- else: print (((79.55-grade2)/20)*100)
- print "for a C"
- if (69.55-grade2)/20<0:
- print ( "0" )
- else: print (((69.55-grade2)/20)*100)
- print "for a D"
- if (59.55-grade2)/20<0:
- print ( "0" )
- else: print (((59.55-grade2)/20)*100)
- print "NOTE- if there is a 0 or a number over 100 displayed on the grade,"
- print "that means that you can not get that grade"
- while constant == 1:
- if firstrun == True:
- intro()
- start()
- firstrun = False # sets the variable to false so it will go to the else on the next run
- inter()
- # I was having some trouble with the repeting scrips not asking if you wanted
- # to calculate the grade again and would just give you a promp for it. so I added
- # another function that did ask
- else:
- answer = raw_input ( ">" ) # dont forget to add a raw_input, it can be very frusterating when you dont.
- if answer == "y":
- start()
- print ""
- print "Do you want to calculate your grade again.(y,n)"
- else:
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement