首页 > 编程语言 > 详细

学习python的第八天

时间:2019-11-22 11:50:26      阅读:74      评论:0      收藏:0      [点我收藏+]

九九乘法

#九九乘法表

"""line = 9
while line > 0:
    #print ("*")
    tmp = line
    while tmp>0 :
    
        print ("*",end="")
        tmp -=1
    print ()
    line -=1"""

first = 1
while first <= 9:

    sec = 1
    while sec <= first:
        print(  str(sec)+"*"+ str(first) +"="+str(sec * first), end="\t")
        sec += 1
    
    print()
    
    first += 1

    
"""print("1*1=",1)

# "1*1=",1  == str(m)+"*"+str(n)+"=",1


m = 2
n = 2

print( str(m)+ "*" + str(n) + "=" , m*n  )
    
    
    
line = 5    # 第一步 : 赋值
while line>0:  # 第二部 line=5

    tmp = line  #  第三部 : tmp =5   tmp=4
    
    while  tmp>0:  #  第四部 : tmp =5   #第七步 tmp=4    #第十部: tmp=3   第十三步 tmp=2
        print("*",end="") #第五步   #第八部        #第十一部               #第十四步
        tmp = tmp-1   # 第六步 tmp = 4  # 第九步 tmp=3  # 第十二步 tmp=2   第十五步 tmp= 1 
        
    print()
    #print(line)
    line -= 1
 """   
    
"""first = 1
while first<=9:

    sec = 1    
    while sec <= first:
        print(  str(sec)+"*"+ str(first) +"="+str(sec * first), end="\t")
        sec += 1

        
    print()
    
    
    first += 1"""

1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

学习python的第八天

原文:https://www.cnblogs.com/hanhankeji/p/11910477.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!