![](/img/trans.png)
[英]for-loop issue (how to use i-parameter on the obj name created within the for-loop)
[英]Not Able To use for-loop
** 我想使用兩個for 循環而不是兩個while 循環**
i = 7
while i >= 1:
j = i
while j <= 7:
print(j, end =" ")
J += 1
i -= 1
print()
以下是for-loop
:
for i in range(7, 0, -1):
j = i
for j in range(i, 8):
print(j, end=" ")
print()
關鍵是正確使用range(start, stop, step)
。 另請參閱此。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.