简单的三次登陆和入门级九九乘法表的实现

三次登陆

流程图

_user = "aa"
_passwd = "123456"
count = 0
while count < 3: #当这个条件成立时,执行下面代码
    username = input('enter username:')
    password = input('enter password:')
    if username == _user and password == _passwd:
        print('welcome %s login'% _user)
        break #终止,跳出
    else:
        print('username or password is wrong')
    count += 1
    if count == 3:
        count_going = input('还想继续吗?[y/n]:')
        if count_going == 'y':
            count = 0
else:
    print("输入次数太多了!!!")

 九九乘法表

x = 1
while x <=9:
    y = 1
    while y <= x:
        print(str(x)+'*'+str(y)+'=',x*y,end='\t')
        y +=1
    print()
    x +=1

  

posted @ 2016-08-23 21:47  Dwyane.wang  阅读(460)  评论(0编辑  收藏  举报