Dictionaries, Teil 1

Python für Fortgeschrittene

Hugo Bowne-Anderson

Data Scientist at DataCamp

Liste

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"]
ind_alb = countries.index("albania")
ind_alb
1
pop[ind_alb]
2.77
  • Nicht praktisch
  • Nicht intuitiv
Python für Fortgeschrittene

Dictionary

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"] ...
{ }
Python für Fortgeschrittene

Dictionary

pop = [30.55, 2.77, 39.21]

countries = ["afghanistan", "albania", "algeria"] ...
{"afghanistan":30.55, }
Python für Fortgeschrittene

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 für Fortgeschrittene

Lass uns üben!

Python für Fortgeschrittene

Preparing Video For Download...