How to get the count and the value from an iterable in Python?

Опубликовано: 12 Октябрь 2024
на канале: Pybites
172
17

In this video we'll show C-style looping with doing it more Pythonically using the enumerate() built-in function to get the count and the value in one go.

Links:
Docs: https://docs.python.org/3/library/fun...
Related video - Useful Python Built-in Functions [Beginner / Intermediate]:    • Useful Python Built-in Functions [Beg...  
Related Pybites exercise: https://codechalleng.es/bites/15/
Related Pybites tips: https://codechalleng.es/tips/enumerate + https://codechalleng.es/tips/print-n-... (and to get 250 of these kind of "how to write idiomatic code" tips, check out our book here: https://pybit.es/tips/)

---
Learn more about Pybites / what we do: https://pybit.es

Get our weekly developer / mindset emails: https://pybit.es/friends/

Join our Slack community: https://pybit.es/community/

And last but not least, we appreciate any feedback to make our YouTube content better 💡
https://form.jotform.com/230941798741062 🙏