首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >while循环重复打印行-中断?

while循环重复打印行-中断?
EN

Stack Overflow用户
提问于 2017-06-12 07:41:24
回答 0查看 67关注 0票数 0

如果字符数不是11,我如何停止重复打印消息的代码?我想让它重复这个循环,直到输入了正确的字符数,但它没有做到这一点。

代码语言:javascript
复制
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")
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44489713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档