Python学习心得第二周-作业

#打印九九乘法表

for a in range(1,10):
    for b in range(1,a+1):
        res='{}*{}={}'.format(a,b,a*b)
        print(res,end='\t')
    print()
View Code

#打印金字塔

#for

for a in range(1,10,2):
    m = a * '*'
    print(m.center(10))
View Code

#while

a='*'
count=1
while count < 10:
    print((a*count).center(10) ,end='\n')
    count+=2
View Code

 

posted @ 2018-07-04 22:15  天天吃饭团  阅读(328)  评论(0编辑  收藏  举报