places = ["Jack", "John", "Sochi"]
count=0
multi_word=0
place = places[count]
while place != "Sochi" and count < len(places):
if ' ' in place:
multi_word += 1
count += 1
place = places[count]
print ('Number of cities before Sochi:', count)
我的代码应该打印 Sochi 之前的城市数量,不包括 Sochi 。我不明白这条线 (place = places[count]) 做了什么,也不明白为什么我需要它两次。