I want to print :
1
12
123
1234
,我曾嘗試:如何使用循環創建直角三角形?
num=int(input("number"))
space=int(num)
count=1
while count<num:
if count==1:
print(" "*space,count)
count=count+1
space=space-1
while count>=2:
for n in range(2,num):
print(" "*space,list(range(1,n))
space=space-1
但它不工作。 如何打印指定的結果? 感謝
請將代碼放在帖子中,而不是它的圖像。 – Phylogenesis
請修正代碼的縮進情況,以便它能夠精確表示您在編輯器中的代碼。 – idjaw
我剛剛上傳了代碼。 – triumpyhyale