模式A
num = int(input("请输入模式A的层数:"))
for i in range(1, num + 1):# 画数字for j in range(1, i + 1):print(str(j) + "\t", end="")print()
模式B
num = int(input("请输入模式B的层数:"))
for i in range(num, 0, -1):# 画数字for j in range(1, i + 1):print(str(j) + "\t", end="")print()
模式C
num = int(input("请输入模式C的层数:"))
for i in range(1, num + 1):# 画空格for _ in range(num - i):print("\t", end="")# 画数字for j in range(1, i + 1):print(str(j) + "\t", end="")print()
模式D
num = int(input("请输入模式D的层数:"))
for i in range(1, num + 1):#画空格for _ in range(1, i):print("\t", end="")#画数字for j in range(1, num - i + 2):print(str(j) + "\t", end="")print()