ユーザーが自分のアカウントにログインして設定したコマンドを使用できるログインシステムを作成しようとしていますが、ユーザーがログインシステムに登録できるように、いくつかの追加入力を追加したかったのです。設定したコマンドを使用します。ユーザーが行った入力を毎回別の変数に永続的に保存して、ユーザーがコードを再起動したときにシステムにログインでき、再度登録する必要がないようにしたいと考えていました。
これまでに作成したコードは次のとおりです。
print ("Welcome!")
print ("Would you like to register")
loop = True
while (loop == True):
username = input ("username: ")
password = input ("password: ")
print ("register here if you don't have an account")
username1 = input ("name: ")
print ("this is what you use to login to the system")
username2 = input ("username: ")
username3 = input ("password: ")
if (username == "rohit" and password == "rodude") :
print ("hello and welcome " + username or )
loop = False
loop1 = True
else:
print ("invalid username and password")
while(loop1 == True):
command = str(input(username + "{} > >"))
if(command.lower() == "exit"):
loop1=False
elif(command.lower() == "hi"):
print("Hi " + username + "!")
else:
print ("'" + command + "' is an invalid command!")