August 2021
Beginner to intermediate
112 pages
1h 29m
English
| Puzzle 14 | A Tale of One City |
| | import pandas as pd |
| | |
| | cities = pd.DataFrame([ |
| | ('Vienna', 'Austria', 1_899_055), |
| | ('Sofia', 'Bulgaria', 1_238_438), |
| | ('Tekirdağ', 'Turkey', 1_055_412), |
| | ], columns=['City', 'Country', 'Population']) |
| | |
| | |
| | def population_of(city): |
| | return cities[cities['City'] == city]['Population'] |
| | |
| | |
| | city = 'Tekirdağ' |
| | print(population_of(city)) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: Series([], Name: Population, ...
Read now
Unlock full access