Python for Loops and while Loops Explained with Examples (range, break, continue)
Ravindra Bagale's Tip — Chala mitrano
A computer is great at doing the same job 10,000 times without getting tired. Loops are how we tell it to. Today we loop over lists, numbers and dictionaries.
Ravindra Bagale's Tip – चला मित्रांनो
Computer तेच काम 10,000 वेळा न थकता करू शकतो. Loops ने आपण त्याला ते सांगतो. आज lists, numbers आणि dictionaries वर loop करू.
Ravindra Bagale's Tip – चलो दोस्तों
Computer वही काम 10,000 बार बिना थके कर सकता है. Loops से हम उसे ये बताते हैं. आज lists, numbers और dictionaries पर loop करेंगे.
What you will learn in this chapter
- for loops over lists and strings
- range() for counting
- Looping over dictionaries and with enumerate
- Collecting results while looping
- while loops
- break and continue
- List comprehensions — the short form
Practice data
All names, shops, banks, hospitals and amounts in this chapter are made up for learning. They are not real people or real company numbers.