places = [\"Jack\", \"John\", \"Sochi\"]
count=0
multi_word=0
place = places[count]
while place != \"Sochi\" and count < len(places):
if \' \' in place:
You can use the following while loop to check for the number of places before Sochi:
places = ["Jack", "John", "Sochi"]
count = 0
multi_word = 0
while count < len(places):
place = places[count]
if ' ' in place:
multi_word += 1
if place == "Sochi":
break
count += 1
print('Number of cities before Sochi:', count)
The break statement means you'll exit your while loop.