- Hello world in python
- How to add two numbers in python
- If else statement python
- Lists tuples and dictionaries
- Loops in python
- Python Functions
- How To Reverse Number In Python
- How to create voice from words and How to play music in Python
- How to Sort Dictionary using keys or values python
- Python Lambda
- Python map() filter() and reduce() functions
- What does if __name__ == "__main__": do?
Loops in python
A loop is used for iterating in data structure for example list,tuple,set or a dictionary, also loops can be utilized to iterate in strings.
There are two types of loops in python
1) For loop
2) While loop
Mostly while loop is used whenever you want to execute block of code until any given condition is satisfied
below is simple demonstration of for loop to iterate in list.
For loop using range() function
In above script 0 is representing starting index of for loop 10 isrepresenting ending index although loop will run less then 10 times that is 9 so range will be from 0 to 9, and +2 is incremental of for loop
Basic syntax of while loop is given below
below is simple demonstration of while loop to iterate in list.
Subscribe to my youtube channel
May 7, 2021, 7:20 a.m.
May 23, 2021, 12:19 p.m.
June 21, 2021, 3:08 p.m.
Aug. 26, 2021, 10:22 a.m.
Start watching python tutorials
April 21, 2021, 6:08 p.m.