如果字符数不是11,我如何停止重复打印消息的代码?我想让它重复这个循环,直到输入了正确的字符数,但它没有做到这一点。
phone = input(str("enter the phone number"))
while len(phone) !=11:
if len(phone)>11:
print("you entered too many numbers")
elif len(phone)<11:
print("you entered too few numbers")
else:
print ("correct phone number length")https://stackoverflow.com/questions/44489713
复制相似问题