【发布时间】:2020-01-07 00:13:53
【问题描述】:
所以我在 edx 上学习了 Python 的第二门课程,这是我编写的代码,但并不真正理解 while 循环中的部分。有人可以像我 6 岁那样向我解释那里发生了什么吗?
代码:
# [ ] Print each word in the quote on a new line
quote = "they stumble who run fast"
start = 0
space_index = quote.find(" ")
while space_index != -1: #the code in while needs to be explained to me
print(quote[start:space_index])
start = space_index +1
space_index = quote.find(" ", space_index +1)
【问题讨论】:
标签: python-3.x loops while-loop