Cities

Report a typo

Imagine you have a file where you can find information about the population and the sizes of all the cities in the world. City names are in the first column, their population is in the second one, the sizes are in the third one. You also have a code that computes the number of cities that have a population of more than 1000000 people. Unfortunately, the lines got mixed. You need to put them in the right order.

NB: Please, use examples from the theory as a reference and initialize the count variable after opening the file.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                if int(split_line[1]) > 1000000:
              
                with open("cities", "r", encoding='utf-8') as cities:
              
                split_line = line.split(",")
              
                count = 0
              
                for line in cities:
              
                count += 1
              
___

Create a free account to access the full topic