同じ日に別の問題が発生するのは嫌いですが、2つは言うまでもなく、アカウントを登録および削除する方法が必要です。スクリプト全体は次のとおりです。
accounts={'Robrajow':'password', 'Hacker':'hack', 'Noob':'lololol1'}
option1=0
option2=0
loop=1
while loop==1:
print "Welcome to Telemology! You can login, register, delete an account, or exit."
loginchoice = raw_input("What would you like to do? ")
if loginchoice=='login':
choice = raw_input("What is your username? ")
choice2 = raw_input("What is your password? ")
if (choice in accounts):
option1=1
else:
option1=0
if (choice2 == accounts[choice]):
option2=1
else
option2=0
if option1==1 and option2==1:
print "Welcome to Telemology,", choice
else:
print "The username or password you entered is incorrect. Please try again or register."
elif loginchoice=='register':
newuser=raw_input("What is your new username? ")
if (newuser in accounts):
newuser=raw_input("That account name is already taken. Please enter another: ")
newpass=raw_input("What is your new password? ")
print newuser,", welcome to Telemology!"
print newpass, "is your new password!"
print "Write it down and hide it!"
elif loginchoice=='delete':
unsure=raw_input("Do you really want to delete your account? It will never return! ")
if unsure=='yes':
choice = raw_input("What is your username? ")
choice2 = raw_input("What is your password? ")
if choice in accounts:
option1=1
else:
option1=0
if choice2 in password:
option2=1
else:
option2=0
if option1==1 and option2==1:
print "Goodbye forever,", choice
else:
print "The username or password you entered is incorrect."
elif unsure=='no':
print "I hoped so."
else:
print "Invalid input."
elif loginchoice==exit:
print "Goodbye!"
loop=0
else:
print "What? You can only input login, delete, register, or exit."
1つに置き換えることができる多数のエラーと複雑なコード行は無視してください。アカウント(別名辞書エントリ)を登録および削除する方法だけが必要です。
あなたが私のためにスクリプト全体を書き直すことにしたという偶然の機会に、多くの義務がありました。