def f():
n=int(input(":"))
for i in range(0,n+1):
if i ==0:
print(" "*(n)+"$")
elif i==n:
print("$"*(2*n-1))
else:
print(" "*(n-i)+"$"+((2*i)-1)*" " +"$")
if __name__ == '__main__':
f()
标签:__,elif,打印,形状,print,金字塔
From: https://www.cnblogs.com/JK8395/p/16796046.html