Dictionaries, deel 1

Python voor gemiddeld niveau

Hugo Bowne-Anderson

Data Scientist at DataCamp

Lijst

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"]
ind_alb = countries.index("albania")
ind_alb
1
pop[ind_alb]
2.77
  • Niet handig
  • Niet intuïtief
Python voor gemiddeld niveau

Dictionary

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"] ...
{ }
Python voor gemiddeld niveau

Dictionary

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"] ...
{"afghanistan":30.55, }
Python voor gemiddeld niveau

Dictionary

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"] ...
world = {"afghanistan":30.55, "albania":2.77, "algeria":39.21}
world["albania"]
2.77
Python voor gemiddeld niveau

Laten we oefenen!

Python voor gemiddeld niveau

Preparing Video For Download...