小编Wil*_*Gfx的帖子

elif没有使用python代码创建密码

我是python的新手.每当我使用" elif"时,它表示它是无效的语法.有人可以帮忙解决问题吗?

repeat = True
while repeat:
 password = input("Please enter a password: ")
 if (len(password)) <8:
       choice = input ("Your password needs to have at least 8 letters. 1 = Try Again, 2 = Exit: ")
       if choice == "2":
        repeat = False
 else:
    print ("That is a valid password.")
    exit
 elif not any(char.isdigit() for char in password):
      choice = input ("Your password needs to have at least 1 number in it. 1 = Try Again, 2 = …
Run Code Online (Sandbox Code Playgroud)

python

-1
推荐指数
1
解决办法
61
查看次数

标签 统计

python ×1