浅谈 while 循环用法

count = 1
while count < 3 :
    userd = input('用户登录:')
    psd = input('密码:')
    if userd == 'chentianjia' and pad == 'chen123..':
        print('欢迎光临')
        pass
    else:
        print('用户账号或者密码错误')
    count = 1 + count

whiile count <3 是将自己包含 if语句循环三次

不归属的不受限制,无限循环,例如,count = 1+count

count = 1
while count < 3 :
    userd = input('用户登录:')
    psd = input('密码:')
    if userd == 'chentianjia' and pad == 'chen123..':
        print('欢迎光临')
        pass
    else:
        print('用户账号或者密码错误')
count = 1 + count

 

posted @ 2018-11-14 06:49  励志学会编程的老男人  阅读(847)  评论(0编辑  收藏  举报