两次动态输入和while的结合使用

a=input('请选择0或1;')
if int(a)==0:
    print('退出')
while True:
    b=input('输入账号:')
    c=input('输入密码:')
    if b=='123' and c=='456':
        print('正确')
        break

 第一次的if判断直接嵌入到第二次动态输入的while中  注意while后面必须加判断语句.if不成立直接循环while语句

原文地址:https://www.cnblogs.com/zhangzhaohua/p/9843331.html