import time
def Scenario2():
film_comedy = ['Anchorman','The Hangover','Ted']
film_horror = ['The Exorcist','The Shining','Scream']
film_action = ['Die Hard','The Matrix','Batman']
film_animation = ['Toy Story','The Incredibles','The Lion King']
print("Hello, welcome to the online streaming service")
username = len(input("Please Enter a username between 4 and 12 characters: "))
while username < 4 or username > 12:
print("That username is not within the boundaries")
username = len(input("Please Enter a username between 4 and 12 characters: "))
password = input("Now enter a password: ")
password1 = input("Please re-enter the password: ")
if password1 == password:
print("Congratualtions on your new account")
while password1 != password:
print("They don't match")
password = input("Now enter a password: ")
password1 = input("Please re-enter the password: ")
if password1 == password:
print("Congratualations on your new account")
usernameinput = input("Please Enter your username: ")
if usernameinput == username:
print("Great job")
while usernameinput != username:
print("That is the incorrect Username")
usernameinput = input("Please Enter your username: ")
if usernameinput == username:
print("Great job")
Scenario2()
每当我输入与用户名相同的usernameinput时。它并不能说好工作,但这是不正确的。
我可以帮忙解决这个问题吗?
答案 0 :(得分:2)
username = len(input("Please Enter a username between 4 and 12 characters: "))
这不起作用,因为您已在此while
循环之前指定了{{1}},因此请重命名变量以使其生效。
答案 1 :(得分:1)
Username
被指定为输入的长度,而不是输入。您还需要引入一个单独的变量来分配输入。