Перейти к содержимому

Python Dictionary Comprehensions: Build Lookups from Loops | Advanced Python Lesson 24

Tekotive

0:00 / 0:00

Python Dictionary Comprehensions: Build Lookups from Loops | Advanced Python Lesson 24

1 просмотр · 6 дн. назад
Tekotive
15 подписчиков
1 просмотр · 6 дн. назад
Python Dictionary Comprehensions: Build Lookups from Loops. In this Advanced Python lesson you learn how to start from an ordinary loop and write the dictionary comprehension, how to trace each key and value, why the source stays unchanged, transforming values, filtering entries, filtering and transforming together, building a lookup from records, duplicate keys, common errors and complexity. One running example, a teacher's grading app, carries through the whole lesson, and every code line is highlighted as it is explained. In this lesson: The gradebook needs a new lookup Start with an ordinary loop Write the comprehension Trace each key and value The source remains unchanged Transform dictionary values Filter dictionary entries Filter and transform together Build a lookup from records Duplicate keys overwrite values Common errors and complexity Finish the student report Chapters: 0:00 The gradebook needs a new lookup 0:38 Start with an ordinary loop 1:09 Write the comprehension 1:41 Trace each key and value 2:14 The source remains unchanged 2:47 Transform dictionary values 3:13 Filter dictionary entries 3:40 Filter and transform together 4:04 Build a lookup from records 4:33 Duplicate keys overwrite values 5:05 Common errors and complexity 5:41 Finish the student report Advanced Python Mastery, lesson 24. You should already know variables, loops, functions and printing. From Tekotive. More lectures:    / @tekotive