Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created December 16, 2013 13:42
Show Gist options
  • Save cigrainger/7987068 to your computer and use it in GitHub Desktop.
Save cigrainger/7987068 to your computer and use it in GitHub Desktop.
def newstudent():
newname = raw_input("What is the student's name? ")
# newname = fuzzynames(newname)
if newname == 'quit':
return 'Okay! Nevermind.'
if newname in students.keys():
addnew = raw_input("%s is already in the list. Are you sure you want to add them again? y/n? " % newname)
while addnew != 'y' and addnew!= 'n':
addnew = raw_input("This is y/n only. %s is already in the list. Are you sure you want to add them again? y/n? " % newname)
if addnew == 'y':
newemail = raw_input("What is the student's email address? ")
if newemail in students.values():
email = students.keys()[students.values().index(newemail)]
addnew = raw_input("%s is already used by another student, %s. Are you sure you want to add it to a new student? y/n? " % (newemail, email))
while addnew != 'y' and addnew!= 'n':
addnew = raw_input("This is y/n only. %s is already in the list. Are you sure you want to add them again? y/n? " % newname)
if addnew == 'y':
students[newname] = newemail
if addnew == 'n':
return "Okay, let's try again."
else:
students[newname] = newemail
elif addnew == 'n':
return "Okay, let's try again."
else:
newemail = raw_input("What is the student's email address? ")
if newemail in students.values():
email = students.keys()[students.values().index(newemail)]
addnew = raw_input("%s is already used by another student, %s. Are you sure you want to add it to a new student? y/n? " % (newemail, email))
while addnew != 'y' and addnew!= 'n':
raw_input("This is y/n only. %s is already in the list. Are you sure you want to add them again? y/n? " % newname)
if addnew == 'y':
students[newname] = newemail
elif addnew == 'n':
return "Okay, let's try again."
students[newname] = newemail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment