PYTHON CORE · LESSON 46
All dictionary pairs
Method of items · about 12 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Type a dictionary pair loop. Check the indentation.
ages = {"кот": 2, "пёс": 4}
for pet, age in ages.items():
print(pet, age)Open the editor for class workSolve it yourself
Create scores: Leo has 2 points, Ani 3. Loop items display the name and points of each pair.
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework