代码区域不起作用?

2024-10-05 14:27:10 发布

您现在位置:Python中文网/ 问答频道 /正文

代码:

#Welcome the user to the application.
print("Hello, please enter a password with a minimum of six characters and a max of twelve.");

#Set a variable called MinPass and set a value of 6.
MinPass = 6;

#Set a variable called MaxPass and set a value of 12.
MaxPass = 12;

#Set variable EnteredPass and wait for user input
EnteredPass = input("Password: ");

while len(EnteredPass) < MinPass:
    print("Your password is too short, please enter a longer password and try again")
    EnteredPass = input("Password: ");

while len(EnteredPass) > MaxPass:
    print("Your password is too long, please shorten it and try again!");
    EnteredPass = input("Password: ");
else:
  print("Accepted!")

  while EnteredPass.isdigit:
    print("Needs letters");
    EnteredPass = input("Password: ");

if EnteredPass.isalpha:
  print("Needs numbers")
  EnteredPass = input("Password: ")

问题是:

当我运行程序,输入错误的东西,它总是运行相同的功能,我不知道为什么


Tags: andoftheinputpasswordvariableprintplease