Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Created December 25, 2010 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuclearsandwich/754989 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/754989 to your computer and use it in GitHub Desktop.
The Python program I used to make sure my brother's grades allowed him to get his Christmas present.
print("Welcome Jeremy, we've been waiting for you.")
print("We're going to find out if you've been naughty or nice.")
print("Enter your grades one line at a time, then put DONE")
cipher = "Orrn#wr#wkh#ohiw#ri#wkh#Dufdgh#Fdelqhw"
grades = []
grade = input()
while grade != "DONE":
grades.append(grade[0])
grade = input()
gpas = []
for g in grades:
if g == 'A' or g == 'a':
gpas.append(4.0)
elif g == 'B' or g == 'b':
gpas.append(3.0)
elif g == 'C' or g == 'c':
gpas.append(2.0)
elif g == 'D' or g == 'd':
gpas.append(1.0)
else:
gpas.append(0.0)
print("Did you lie? I will find out if you did...")
lied = input()
if lied == "yes" or lied == "y":
print("Shame on you.")
exit(32)
total_gpa = sum(gpas) / len(gpas)
print("Your total GPA is " + str(total_gpa))
if total_gpa > 3.0:
treasure = ""
for char in cipher:
treasure += chr(ord(char) - 3)
print(treasure)
else:
print("You'll just have to try better next quarter.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment