看板 Python 關於我們 聯絡資訊
各位先進好,目前我在自學PYTHON 使用的書精通PYTHON,目前學到第四章有遇到一個問題 想請前輩協助解答 numbers = [1,3,5] >>> position = 0 >>> while position < len(numbers): ... number = numbers[position] ... if number % 2 == 0: ... print('Found even number', number) ... break ... position += 1 ... else: # break not called ... print('No even number found') ... No even number found 主要是紅色的這段語法 我不明白 numbers[position]的意思 再麻煩前輩了,謝謝。 PS.如果有人有PYTHON的學習群組,再拜託加我,謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 112.97.243.163 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1533033683.A.1F6.html ※ 編輯: ipodnapin (112.97.243.163), 07/31/2018 18:42:22 ※ 編輯: ipodnapin (112.97.243.163), 07/31/2018 18:42:45
djshen: 前幾章有提到list? 07/31 18:46
cryinrain: ch3就在講list了 07/31 19:11
※ 編輯: ipodnapin (112.97.243.163), 07/31/2018 19:16:45
cphe: 就是指把numbers這個list裡的資料取出,每次迴圈依序取 08/03 01:17
cphe: 先回去看list,要不然越來越多不懂你會看不下去的 08/03 01:17