Python Tuples and Unpacking: Fixed Values, Swaps and enumerate() (2027)
Developers Assist
0:00 / 0:00
Python Tuples and Unpacking: Fixed Values, Swaps and enumerate() (2027)
17 просмотров · 2 недели назад
Developers Assist
45 подписчиков
17 просмотров · 2 недели назад
Modern Python in 2027 uses tuples more than beginners expect. Lists can change, and that's usually what you want. But some values should never change by accident, like a map location or a date of birth. Today: tuples, and a neat trick called unpacking.
📘 Python Zero to Pro, lecture 19 of 48: a complete Python course for college students, fully updated for 2027, from your first line of code to AI-powered projects.
In this lecture:
• What's a tuple? Round brackets, and it can't change
• Unpacking: lat, lon = location
• Two handy tricks: Swap, and divmod
• Numbered loops: enumerate
• Lists of tuples: A leaderboard with names
Chapters
00:00 Introduction
00:25 What Is a Tuple?
00:56 Unpacking
01:16 Two Handy Tricks
01:34 Numbered Loops
01:44 Lists of Tuples
02:03 Recap & Next Steps
✍️ Practice task
• Print the cities numbered with enumerate
• Print the hottest: max(cities)
• Bonus: swap two variables in one line
⏭️ Next: lecture 20, Python Dictionaries: Store, Look Up and Loop Over Real App Data (2027)
🔔 Subscribe for the next lecture: / @developersassist
#Python #LearnPython #PythonTutorial