Python练习题实现汇总

练习1 2019-3-19
#
写一个函数实现99乘法表 def x99(x): if x >=1 and x <=9: line = 1 while line <= x: start=1 while start <= line: print('{0}*{1}={2}'.format(start,line,start*line),end=' ') start+=1 print() line+=1 else: print('参数在1-9的正整数范围内!') # 调用函数 x99(9)

练习2 2019-3-19
# 1到4能组成多少个互不相同且不重复数字的三位数?分别是?


for x in range(1,5):
    for y in range(1,5):
        for z in range(1,5):
            if x != y and y != z and x != z:
                print(x,y,z)


猜你喜欢

转载自www.cnblogs.com/wangdecheng/p/10556716.html