places = [\"Jack\", \"John\", \"Sochi\"] count=0 multi_word=0 place = places[count] while place != \"Sochi\" and count < len(places): if \' \' in place:
Why not try a more pythonic solution instead ?
places = ["Jack", "John", "Sochi"] try: count = places.index("Sochi") except ValueError: count = len(places) multi_word = len([place for place in places[:count] if ' ' in place])