#杨辉三角 def triangles(): b=[1] while True: yield b b = [1]+[b[i]+b[i+1] for i in range(len(b)-1)]+[1] #杨辉三角 from My_Functions import triangles n=int(input('please input value n:')) for t in triangles(): print(t) if n == len(t): break
Sign in to make a reply
M斯蕾