SlideShare a Scribd company logo
Loops in Python
hello!
I am Abhay Dhupar
I am here to teach you about LOOPS in Python.
You can find me at @abhaydhupar123@gmail.com
2
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
Airplane Airplane Airplane Airplane Airplane Airplane
3
What are Loops ?
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
print("Abhay")
4
Consider I want to print my name 10 times.
print("Abhay")
OR
A loop is used to repeat an instruction multiple times until a
condition goes wrong.
5
“
There are two primitive loop types in Python –
6
Types of Loops in Python
For in
loop
While
loop
A for in loop is used for iterating over a sequence (that is either a
list, a tuple, a dictionary, a set, or a string)
7
For in Loops
Syntax –
for counter in sequence :
statement(s)
A while loop is used to execute a set of statements as long as a
condition is true.
8
While Loops
Syntax –
while condition :
statement(s)
# for in loop
iterable_objs = range(6)
for iterator in iterable_objs:
print(iterator)
9
# while loop
i = 42
while not(i<=10):
print(i)
i -= 7
With the else statement, we can run a block of code once a
condition is no longer true.
10
The else Statement
Syntax –
while condition :
statement(s)
else :
statement(s)
Loop control statements change execution from its normal
sequence. There are 3 types –
11
Loop Control Statements
break
statement
continue
statement
pass
statement
# Break
for x in range(6):
if x==4:
break
print(x)
# Continue
for y in "Abhay":
if y=='h':
continue
print(y)
# Pass
mylist = [1,2,5,8,6,3]
for c in mylist:
pass
12
For in loop default increments by 1.
Else statement in loop won’t work if the loop is terminated
by break statement.
Nested loop is a type of non primitive loops in python.
In this, we can use multiple for or while loops inside a for or
while loop.
13
Points to be noted
Let’s review Today’s Learning
What is Loops in Python?
In this, we have understood the
basic meaning of loop and have
gone through definition of loops.
Benefits of using Loop
Here we have gone through some
examples which cleared why loops
are efficient and less time
consuming.
Types of Loop in Python
We have learned the two primitive
types of loops in Python and their
implementation.
Else statement in Loop
Here we have learned about the else
statement. It’s implementation and
where it works.
Loop Control Statements
Here, we have gone through the
three different loop statements in
Python. How and where they are
used.
Points to be noted
Here we have covered some extra
points related to our topics.
14
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
thanks! thanks! thanks! thanks! thanks! thanks! thanks!
15
Ad

More Related Content

What's hot (20)

Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Loops in c++ programming language
MUHAMMAD ALI student of IT at karakoram International university gilgit baltistan
 
Lesson 03 python statement, indentation and comments
Lesson 03   python statement, indentation and commentsLesson 03   python statement, indentation and comments
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
C tokens
C tokensC tokens
C tokens
Manu1325
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ayshwarya Baburam
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Kamal Acharya
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
Sokngim Sa
 
Loops c++
Loops c++Loops c++
Loops c++
Shivani Singh
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
Jothi Thilaga P
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Forloop
ForloopForloop
Forloop
Dipen Vasoya
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
Sachin Sharma
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma
 
Functions in c
Functions in cFunctions in c
Functions in c
kalavathisugan
 
Modular programming
Modular programmingModular programming
Modular programming
Mohanlal Sukhadia University (MLSU)
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Maulik Borsaniya
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
narmadhakin
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
Vineeta Garg
 
Function Pointer
Function PointerFunction Pointer
Function Pointer
Dr-Dipali Meher
 

Similar to Loops in Python (20)

a1 this is in python that has break continue and pass.pptx
a1 this is in python  that has break continue and pass.pptxa1 this is in python  that has break continue and pass.pptx
a1 this is in python that has break continue and pass.pptx
urvashipundir04
 
break continue and pass in python progran.pptx
break continue and pass in python progran.pptxbreak continue and pass in python progran.pptx
break continue and pass in python progran.pptx
urvashipundir04
 
Loops in python including control statements and various test cases
Loops in python including control statements and various test casesLoops in python including control statements and various test cases
Loops in python including control statements and various test cases
AnuragSharma710741
 
Loops in python including control statements and various test cases
Loops in python including control statements and various test casesLoops in python including control statements and various test cases
Loops in python including control statements and various test cases
AnuragSharma710741
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
CHANDAN KUMAR
 
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.pptppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
avishekpradhan24
 
6 Iterative Statements.pptx
6 Iterative Statements.pptx6 Iterative Statements.pptx
6 Iterative Statements.pptx
ssuser8e50d8
 
Control_Statements_in_Python.pptx
Control_Statements_in_Python.pptxControl_Statements_in_Python.pptx
Control_Statements_in_Python.pptx
Koteswari Kasireddy
 
E-Notes_3721_Content_Document_20250107032537PM.pdf
E-Notes_3721_Content_Document_20250107032537PM.pdfE-Notes_3721_Content_Document_20250107032537PM.pdf
E-Notes_3721_Content_Document_20250107032537PM.pdf
aayushihirpara297
 
Python basics Control flow chapter 3.pptx
Python basics Control flow chapter 3.pptxPython basics Control flow chapter 3.pptx
Python basics Control flow chapter 3.pptx
yeabtse1234
 
An Introduction to Computer Science with Java, Python an.docx
An Introduction to  Computer Science  with Java, Python an.docxAn Introduction to  Computer Science  with Java, Python an.docx
An Introduction to Computer Science with Java, Python an.docx
amrit47
 
Python made easy
Python made easy Python made easy
Python made easy
Abhishek kumar
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Mohammed Sikander
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
bsdeol28
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
Ruth Marvin
 
Notes2
Notes2Notes2
Notes2
hccit
 
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.pptPPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
RahulKumar812056
 
5. php bangla tutorial php basic
5. php bangla tutorial php basic5. php bangla tutorial php basic
5. php bangla tutorial php basic
SamimKhan19
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
Aniruddha Paul
 
JAVA.pptx
JAVA.pptxJAVA.pptx
JAVA.pptx
DrRSuganyaRengaraj
 
a1 this is in python that has break continue and pass.pptx
a1 this is in python  that has break continue and pass.pptxa1 this is in python  that has break continue and pass.pptx
a1 this is in python that has break continue and pass.pptx
urvashipundir04
 
break continue and pass in python progran.pptx
break continue and pass in python progran.pptxbreak continue and pass in python progran.pptx
break continue and pass in python progran.pptx
urvashipundir04
 
Loops in python including control statements and various test cases
Loops in python including control statements and various test casesLoops in python including control statements and various test cases
Loops in python including control statements and various test cases
AnuragSharma710741
 
Loops in python including control statements and various test cases
Loops in python including control statements and various test casesLoops in python including control statements and various test cases
Loops in python including control statements and various test cases
AnuragSharma710741
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
CHANDAN KUMAR
 
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.pptppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
ppt3-conditionalstatementloopsdictionaryfunctions-240731050730-455ba0fa.ppt
avishekpradhan24
 
6 Iterative Statements.pptx
6 Iterative Statements.pptx6 Iterative Statements.pptx
6 Iterative Statements.pptx
ssuser8e50d8
 
Control_Statements_in_Python.pptx
Control_Statements_in_Python.pptxControl_Statements_in_Python.pptx
Control_Statements_in_Python.pptx
Koteswari Kasireddy
 
E-Notes_3721_Content_Document_20250107032537PM.pdf
E-Notes_3721_Content_Document_20250107032537PM.pdfE-Notes_3721_Content_Document_20250107032537PM.pdf
E-Notes_3721_Content_Document_20250107032537PM.pdf
aayushihirpara297
 
Python basics Control flow chapter 3.pptx
Python basics Control flow chapter 3.pptxPython basics Control flow chapter 3.pptx
Python basics Control flow chapter 3.pptx
yeabtse1234
 
An Introduction to Computer Science with Java, Python an.docx
An Introduction to  Computer Science  with Java, Python an.docxAn Introduction to  Computer Science  with Java, Python an.docx
An Introduction to Computer Science with Java, Python an.docx
amrit47
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
bsdeol28
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
Ruth Marvin
 
Notes2
Notes2Notes2
Notes2
hccit
 
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.pptPPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
PPT3-CONDITIONAL STATEMENT LOOPS DICTIONARY FUNCTIONS.ppt
RahulKumar812056
 
5. php bangla tutorial php basic
5. php bangla tutorial php basic5. php bangla tutorial php basic
5. php bangla tutorial php basic
SamimKhan19
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
Aniruddha Paul
 
Ad

More from AbhayDhupar (8)

JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
AbhayDhupar
 
What is Data analytics and it's importance ?
What is Data analytics and it's importance ?What is Data analytics and it's importance ?
What is Data analytics and it's importance ?
AbhayDhupar
 
Internet & it's concepts
Internet & it's conceptsInternet & it's concepts
Internet & it's concepts
AbhayDhupar
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
AbhayDhupar
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
AbhayDhupar
 
Food chain
Food chainFood chain
Food chain
AbhayDhupar
 
Edge computing
Edge computingEdge computing
Edge computing
AbhayDhupar
 
Sets and its types-
 Sets and its types- Sets and its types-
Sets and its types-
AbhayDhupar
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
AbhayDhupar
 
What is Data analytics and it's importance ?
What is Data analytics and it's importance ?What is Data analytics and it's importance ?
What is Data analytics and it's importance ?
AbhayDhupar
 
Internet & it's concepts
Internet & it's conceptsInternet & it's concepts
Internet & it's concepts
AbhayDhupar
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
AbhayDhupar
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
AbhayDhupar
 
Sets and its types-
 Sets and its types- Sets and its types-
Sets and its types-
AbhayDhupar
 
Ad

Recently uploaded (20)

Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 

Loops in Python

  • 2. hello! I am Abhay Dhupar I am here to teach you about LOOPS in Python. You can find me at @[email protected] 2
  • 3. Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane Airplane 3
  • 4. What are Loops ? print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") print("Abhay") 4 Consider I want to print my name 10 times. print("Abhay") OR
  • 5. A loop is used to repeat an instruction multiple times until a condition goes wrong. 5 “
  • 6. There are two primitive loop types in Python – 6 Types of Loops in Python For in loop While loop
  • 7. A for in loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string) 7 For in Loops Syntax – for counter in sequence : statement(s)
  • 8. A while loop is used to execute a set of statements as long as a condition is true. 8 While Loops Syntax – while condition : statement(s)
  • 9. # for in loop iterable_objs = range(6) for iterator in iterable_objs: print(iterator) 9 # while loop i = 42 while not(i<=10): print(i) i -= 7
  • 10. With the else statement, we can run a block of code once a condition is no longer true. 10 The else Statement Syntax – while condition : statement(s) else : statement(s)
  • 11. Loop control statements change execution from its normal sequence. There are 3 types – 11 Loop Control Statements break statement continue statement pass statement
  • 12. # Break for x in range(6): if x==4: break print(x) # Continue for y in "Abhay": if y=='h': continue print(y) # Pass mylist = [1,2,5,8,6,3] for c in mylist: pass 12
  • 13. For in loop default increments by 1. Else statement in loop won’t work if the loop is terminated by break statement. Nested loop is a type of non primitive loops in python. In this, we can use multiple for or while loops inside a for or while loop. 13 Points to be noted
  • 14. Let’s review Today’s Learning What is Loops in Python? In this, we have understood the basic meaning of loop and have gone through definition of loops. Benefits of using Loop Here we have gone through some examples which cleared why loops are efficient and less time consuming. Types of Loop in Python We have learned the two primitive types of loops in Python and their implementation. Else statement in Loop Here we have learned about the else statement. It’s implementation and where it works. Loop Control Statements Here, we have gone through the three different loop statements in Python. How and where they are used. Points to be noted Here we have covered some extra points related to our topics. 14
  • 15. thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! thanks! 15