ammountofpassword = int(input("Please input the number of usernames needed"))
for counter in range (0,ammountofpassword):
password = str(input("Input the 3 letter password"))
length = len(password)
while length > 3 and length < 3:
print("please enter a 3 letter password")
name = str(input("Please input the 3 letter password"))
print("your password is",password)
答案 0 :(得分:0)
似乎您想让用户输入3个字符的密码。您尝试过这种方法吗?
ammountofpassword = int(input("Please input the number of usernames needed"))
for counter in range (0,ammountofpassword):
password = str(input("Input the 3 letter password"))
length = len(password)
while length != 3:
print("please enter a 3 letter password")
password = str(input("Please input the 3 letter password"))
length = len(password)
print("your password is",password)
答案 1 :(得分:0)
以下情况不正确
df = df.persist()
因为while length > 3 and length < 3:
变量的值永远不会大于和小于length
,所以3
循环将永远不会运行。
您似乎实际上需要使用while
运算符
or
如果while length > 3 or length < 3:
大于或小于True
,则为length
。
进一步,我想使用3
运算符
!=
表示“长度不是3”。