1. 程式人生 > >Python作業之While應用

Python作業之While應用

python () int idt ima xxx height 空格 mage

技術分享

team = input("請輸入一個整數:")
num = int(team)
while num:
i = num -1
while i:
print(‘ ‘,end=‘‘) #註意括號裏面的 ‘‘ 要加個空格哦
i = i- 1
j = num
while j:
print(‘*‘,end=‘‘)
j = j-1
print()
num =num-1

技術分享

team = input("請輸入一個整數:")
num = int(team)
i = 1
while num>=1:
print(i)
i +=1
num -=1

Python作業之While應用