places = [ "Jack", "Jo hn", "Sochi", "Manan", "Mayank"]
count=0
multi_word=0
place = places[count]
while place != "Sochi" :
if ' ' in place:
multi_word += 1
count += 1
place = places[count]
print ('Number of cities before Sochi:', count)
print ('Number of multiple names cities before Sochi:', multi_word)
This is my code I don't understand what this line (place = places[count]) does, nor do I understand why I need it twice.
Does it make the program start at Jack, then add 1 one once it reaches the next element of the list (Jo hn) and add one more and stop after Sochi, or does it add one at the first element of the list, then stop once it reaches Sochi.
whileloop?places[count], but this can be done using a for-loop too.