作者ipodnapin (吸尘器)
看板Python
标题[问题] 自学PYTHON 对书中范例有疑问
时间Tue Jul 31 18:41:21 2018
各位先进好,目前我在自学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://webptt.com/cn.aspx?n=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
1F:→ djshen: 前几章有提到list? 07/31 18:46
2F:推 cryinrain: ch3就在讲list了 07/31 19:11
※ 编辑: ipodnapin (112.97.243.163), 07/31/2018 19:16:45
3F:推 cphe: 就是指把numbers这个list里的资料取出,每次回圈依序取 08/03 01:17
4F:→ cphe: 先回去看list,要不然越来越多不懂你会看不下去的 08/03 01:17