模式A # n = int(input("输入的层数")) # for i in range(1, n + 1): # for _ in range(n): # print("") # for j in range( 1, i + 1): # print(f"{j}",end=" ") # print() # #模式B # n = int(input("输入的层数")) # for i in range(1,n +1 ): # for _ in range(i,1): # print(" ", end=" ") # for j in range(1, n - i +2): # print(f"{j} ", end=" ") # print() #模式C n = int(input("请输入三角形层数:")) for i in range(1,n+1): for _ in range(n-i): print(" ",end="") for j in range(i , 0, -1): print(f"{j}",end=" ") print() #模式D n = int(input("请输入三角形层数:")) for i in range(1,n+1): for _ in range(1,i+i): print(" ",end=" ") for j in range(1 , n -i+2): print(f"{j}",end=" ") print()
【无标题】
最新推荐文章于 2024-08-14 23:12:09 发布