-8
A
回答
-2
因爲當pat = 24
,程序這將在else第一個條件應該大於或等於和然後試圖訪問該指數24的範圍內,但最後指數爲23。
roue = range(24)
pat = int(input())
if pat >= 24:
while pat >= 24:
pat -= 24
else:
while pat < 0:
pat += 24
print(roue[pat])
+0
請停止回答不包含任何內容的問題。這樣做可以消除海報編輯它們的任何動機,這意味着它們對未來的讀者沒有價值。想要幫助是件好事,但這裏的最終目標是幫助未來的人們以及這張海報。 –
+0
這個answear非常重要謝謝你的幫助Andres here another answear: nbZones = int(input()) print(nbZones%24) –
相關問題
- 1. 蟒蛇:IndexError:列表分配索引超出範圍
- 2. IndexError:列表索引超出範圍蟒蛇
- 3. IndexError:字符串索引超出範圍,pyserial的Tkinter,蟒蛇3.4
- 4. IndexError:列表索引超出範圍| webapp2
- 5. IndexError:列表索引超出範圍
- 6. python IndexError:列表索引超出範圍
- 7. IndexError:列表索引超出範圍
- 8. IndexError:列表索引超出範圍?
- 9. IndexError:列表索引超出範圍
- 10. IndexError:列表索引超出範圍'
- 11. Python ::「IndexError:列表索引超出範圍」
- 12. IndexError:列表索引超出範圍
- 13. IndexError:列表索引超出範圍蟒 - 3.4.3
- 14. IndexError:列表索引超出範圍。它應該在範圍
- 15. 索引超出範圍/ IndexError
- 16. 列表索引超出範圍蟒蛇的3.6
- 17. CSV列表索引超出範圍 - 蟒蛇
- 18. 蟒蛇:列表分配索引超出範圍
- 19. 蟒蛇二維數組列表索引超出範圍
- 20. 獲取列表索引的範圍內,蟒蛇產生誤會
- 21. 列表訪問給予 - IndexError:列表索引超出範圍
- 22. python - IndexError:列表索引超出範圍/劃分列表
- 23. Python的多維列表 - IndexError:列表索引超出範圍
- 24. 追加列表(IndexError:列表索引超出範圍)
- 25. Python IndexError:列表索引超出範圍 - 2d列表迭代
- 26. 「IndexError:列表索引超出範圍」列表深遠
- 27. IndexError:字符串索引超出範圍巨蟒
- 28. IndexError:元組索引超出範圍巨蟒的PostgreSQL
- 29. IndexError:列表索引超出範圍蟒蛇,知道意思,但不明白爲什麼會這樣
- 30. 範圍類蟒蛇
告訴你的代碼,如文本,請 –
請發表您的代碼在你的問題,不只是鏈接的屏幕截圖。 – Zinki
https://stackoverflow.com/help/how-to-ask –