SlideShare a Scribd company logo
PYTHON
SESSION: CONTROL STRUCTURES IN PYTHON
PREPARED BY:
Anub A
CONTENTS
REVIEW OF LAST CLASS
CONDITIONAL STATEMENTS
ITERATIVE STATEMNETS
CONTROL STRUCTURES
IF , IF ELSE , IF ELIF
IF , IF ELSE , IF ELE IF
Prepared By : Anub A
Review
• Keywords and Identifier
• Python Comments
• Python Variables
• Python Data Types
• Python Type Conversion
• Python I/O and Import
• Python Operators
• Python Namespace
Prepared By : Anub A
CONTROL STRUCTURES
• Python provides control structures to manage the
order of execution of a program
• In a python program, statements executes in
following three manners:
Prepared By : Anub A
1. SEQUENTIAL MANNER
2. SELECTIVE OR CONDITIONAL MANNER
3. ITERATIVE OR LOOP MANNER
SEQUENTIAL MANNER
Prepared By : Anub A
• Sequence is the default control structure
• Instructions executed one after other
# This program adds two numbers
def sum_of_two_no():
num1 = 1.5
num2 = 6.3
sum = float(num1) + float(num2)
print('The sum is =‘, sum)
sum_of_two_no():
SELECTIVE OR CONDITIONAL
Prepared By : Anub A
• Conditional constructs (also known as if
statements) provide a way to execute a chosen block
of code based on the run-time evaluation of one or
more Boolean expressions.
• A selection statement causes the program control
to be transferred to a specific flow based upon
whether a certain condition is true or not.
• IF
• IF ELSE
• IF ELIF
Each condition is a Boolean expression, and each body
contains one or more commands that are to be executed
conditionally.
If the first condition succeeds, the first body will be
executed; no other conditions or bodies are evaluated in that
case.
CONSTRUCT – if STATEMENT
if first condition:
Statements
Statements
.
.
.
: Colon Must
If the first condition succeeds, the first body will be
executed; no other conditions or bodies are evaluated in that
case.
Syntax:
EXAMPLES – if STATEMENT
OUT PUT
else is missing, it
is an optional
statement
CONSTRUCT – if else STATEMENT
if first condition:
first body
else:
second body
: Colon Must
• If the first condition succeeds, the first body will be executed;
• If the first condition fails(false case), then the process continues with
the else block.
Syntax:
CONDITIONAL CONSTRUCT – if else STATEMENT
FLOW CHART
Condition ? Statement 1 Statement 2
Statement 1
Statement 2
False
True
else
body
Main
Body
EXAMPLE – if else STATEMENT
OUT PUT
else is
used
: Colon Must
CONDITIONAL CONSTRUCT – if elif STATEMENT
If the first condition fails, then the process continues in
similar manner with the evaluation of the second condition.
The execution of this overall construct will cause precisely one
of the bodies to be executed.
There may be any number of elif clauses (including zero),
and
 The final else clause is optional.
CONDITIONAL CONSTRUCT – if else STATEMENT
second
Condition ?
Statement 1 Statement 2
Statement 1
Statement 2
True
elif
body
Main
Body
first
Condition ?
False
Statement 1
Statement 2
True
CONDITIONAL CONSTRUCT – if else STATEMENT
if first condition:
first body
elif second condition:
second body
elif third condition:
third body
else:
fourth body
: Colon Must
• If the first condition succeeds, the first body will be executed;
• If the first condition fails, then the process continues with next
conditions.
Syntax:
EXAMPLES – if elif STATEMENT
READ AS
18 is less than
age
and
18 is less than
60
OUTPUT
ITERATIVE / LOOPING
Prepared By : Anub A
• Loops can execute a block of code number
of times until a certain condition is met.
• OR
• The iteration statement allows
instructions to be executed until a certain
condition is to be fulfilled.
• The iteration statements are also
called as loops or Looping statements
ITERATION OR LOOPING
Python provides two kinds of loops &
they are,
for loop
while loop
while loop
A while loop allows general repetition based upon the repeated
testing of a Boolean condition
The syntax for a while loop in Python is as follows:
while condition:
body
Where, loop body contain the single statement or set of statements
(compound statement) or an empty statement.
: Colon Must
while loop
The loop iterates while the expression evaluates to
true, when expression becomes false the loop terminates.
FLOW CHART
while loop - programs
OUTPUT
Natural Numbers generation
for LOOP
 Python’s for-loop syntax is a more convenient alternative to a
while loop when iterating through a series of elements.
 The for-loop syntax can be used on any type of iterable structure,
such as a list, tuple str, set, dict, or file
Syntax or general format of for loop is,
for element in iterable:
body
for LOOP
OUTPUT
Till the list
exhaust for loop
will continue to
execute.
for LOOP - range KEYWORD
The range() function returns a sequence of numbers,
starting from 0 by default, and increments by 1 (by default),
and ends at a specified number.
Syntax:
range(start, stop, step)
----------------------------------------------------------------------
Eg 1:
for n in range(3,6):
print(n)
Eg 2:
x = range(3, 6)
for n in x:
print(n)
for LOOP - range KEYWORD
OUTPUT
#Generating series of numbers
Q & A
Prepared By : Anub A
ThankYou
Prepared By : Anub A

More Related Content

Similar to class interview demo (20)

Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
FarshidKhan
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
Emroz Sardar
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
Mushiii
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
deekshagopaliya
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
deekshagopaliya
 
pds first unit module 2 MODULE FOR ppt.pptx
pds first unit module 2 MODULE FOR ppt.pptxpds first unit module 2 MODULE FOR ppt.pptx
pds first unit module 2 MODULE FOR ppt.pptx
bmit1
 
Deeksha gopaliya
Deeksha gopaliyaDeeksha gopaliya
Deeksha gopaliya
deekshagopaliya
 
Week 4.pptx computational thinking and programming
Week 4.pptx computational thinking and programmingWeek 4.pptx computational thinking and programming
Week 4.pptx computational thinking and programming
cricketfundavlogs
 
Loop
LoopLoop
Loop
MdEmonRana
 
Control structures
Control structuresControl structures
Control structures
Gehad Enayat
 
C language (Part 2)
C language (Part 2)C language (Part 2)
C language (Part 2)
Dr. SURBHI SAROHA
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
Anil Dutt
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
ramireddyobulakondar
 
Loop structures
Loop structuresLoop structures
Loop structures
tazeem sana
 
control-statements....ppt - definition
control-statements....ppt    -  definitioncontrol-statements....ppt    -  definition
control-statements....ppt - definition
Papitha7
 
Comp ppt (1)
Comp ppt (1)Comp ppt (1)
Comp ppt (1)
Sriman Sawarthia
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
TANUJ ⠀
 
Lecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + programLecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + program
RahulKumar812056
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
SHRIRANG PINJARKAR
 
Managing input and output operations & Decision making and branching and looping
Managing input and output operations & Decision making and branching and loopingManaging input and output operations & Decision making and branching and looping
Managing input and output operations & Decision making and branching and looping
letheyabala
 
Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
FarshidKhan
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
Emroz Sardar
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
Mushiii
 
pds first unit module 2 MODULE FOR ppt.pptx
pds first unit module 2 MODULE FOR ppt.pptxpds first unit module 2 MODULE FOR ppt.pptx
pds first unit module 2 MODULE FOR ppt.pptx
bmit1
 
Week 4.pptx computational thinking and programming
Week 4.pptx computational thinking and programmingWeek 4.pptx computational thinking and programming
Week 4.pptx computational thinking and programming
cricketfundavlogs
 
Control structures
Control structuresControl structures
Control structures
Gehad Enayat
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
Anil Dutt
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
ramireddyobulakondar
 
control-statements....ppt - definition
control-statements....ppt    -  definitioncontrol-statements....ppt    -  definition
control-statements....ppt - definition
Papitha7
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
TANUJ ⠀
 
Lecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + programLecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + program
RahulKumar812056
 
Managing input and output operations & Decision making and branching and looping
Managing input and output operations & Decision making and branching and loopingManaging input and output operations & Decision making and branching and looping
Managing input and output operations & Decision making and branching and looping
letheyabala
 

Recently uploaded (20)

GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdfGENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
Quiz Club of PSG College of Arts & Science
 
Conditions for Boltzmann Law – Biophysics Lecture Slide
Conditions for Boltzmann Law – Biophysics Lecture SlideConditions for Boltzmann Law – Biophysics Lecture Slide
Conditions for Boltzmann Law – Biophysics Lecture Slide
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ITI COPA Question Paper PDF 2017 Theory MCQ
ITI COPA Question Paper PDF 2017 Theory MCQITI COPA Question Paper PDF 2017 Theory MCQ
ITI COPA Question Paper PDF 2017 Theory MCQ
SONU HEETSON
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic SuccessAerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
online college homework help
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-17-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-17-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-17-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-17-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdfAntepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Dr H.K. Cheema
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
The History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.pptThe History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.ppt
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ITI COPA Question Paper PDF 2017 Theory MCQ
ITI COPA Question Paper PDF 2017 Theory MCQITI COPA Question Paper PDF 2017 Theory MCQ
ITI COPA Question Paper PDF 2017 Theory MCQ
SONU HEETSON
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic SuccessAerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
online college homework help
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdfAntepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Dr H.K. Cheema
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 

class interview demo

  • 1. PYTHON SESSION: CONTROL STRUCTURES IN PYTHON PREPARED BY: Anub A
  • 2. CONTENTS REVIEW OF LAST CLASS CONDITIONAL STATEMENTS ITERATIVE STATEMNETS CONTROL STRUCTURES IF , IF ELSE , IF ELIF IF , IF ELSE , IF ELE IF Prepared By : Anub A
  • 3. Review • Keywords and Identifier • Python Comments • Python Variables • Python Data Types • Python Type Conversion • Python I/O and Import • Python Operators • Python Namespace Prepared By : Anub A
  • 4. CONTROL STRUCTURES • Python provides control structures to manage the order of execution of a program • In a python program, statements executes in following three manners: Prepared By : Anub A 1. SEQUENTIAL MANNER 2. SELECTIVE OR CONDITIONAL MANNER 3. ITERATIVE OR LOOP MANNER
  • 5. SEQUENTIAL MANNER Prepared By : Anub A • Sequence is the default control structure • Instructions executed one after other # This program adds two numbers def sum_of_two_no(): num1 = 1.5 num2 = 6.3 sum = float(num1) + float(num2) print('The sum is =‘, sum) sum_of_two_no():
  • 6. SELECTIVE OR CONDITIONAL Prepared By : Anub A • Conditional constructs (also known as if statements) provide a way to execute a chosen block of code based on the run-time evaluation of one or more Boolean expressions. • A selection statement causes the program control to be transferred to a specific flow based upon whether a certain condition is true or not. • IF • IF ELSE • IF ELIF
  • 7. Each condition is a Boolean expression, and each body contains one or more commands that are to be executed conditionally. If the first condition succeeds, the first body will be executed; no other conditions or bodies are evaluated in that case.
  • 8. CONSTRUCT – if STATEMENT if first condition: Statements Statements . . . : Colon Must If the first condition succeeds, the first body will be executed; no other conditions or bodies are evaluated in that case. Syntax:
  • 9. EXAMPLES – if STATEMENT OUT PUT else is missing, it is an optional statement
  • 10. CONSTRUCT – if else STATEMENT if first condition: first body else: second body : Colon Must • If the first condition succeeds, the first body will be executed; • If the first condition fails(false case), then the process continues with the else block. Syntax:
  • 11. CONDITIONAL CONSTRUCT – if else STATEMENT FLOW CHART Condition ? Statement 1 Statement 2 Statement 1 Statement 2 False True else body Main Body
  • 12. EXAMPLE – if else STATEMENT OUT PUT else is used : Colon Must
  • 13. CONDITIONAL CONSTRUCT – if elif STATEMENT If the first condition fails, then the process continues in similar manner with the evaluation of the second condition. The execution of this overall construct will cause precisely one of the bodies to be executed. There may be any number of elif clauses (including zero), and  The final else clause is optional.
  • 14. CONDITIONAL CONSTRUCT – if else STATEMENT second Condition ? Statement 1 Statement 2 Statement 1 Statement 2 True elif body Main Body first Condition ? False Statement 1 Statement 2 True
  • 15. CONDITIONAL CONSTRUCT – if else STATEMENT if first condition: first body elif second condition: second body elif third condition: third body else: fourth body : Colon Must • If the first condition succeeds, the first body will be executed; • If the first condition fails, then the process continues with next conditions. Syntax:
  • 16. EXAMPLES – if elif STATEMENT READ AS 18 is less than age and 18 is less than 60 OUTPUT
  • 17. ITERATIVE / LOOPING Prepared By : Anub A • Loops can execute a block of code number of times until a certain condition is met. • OR • The iteration statement allows instructions to be executed until a certain condition is to be fulfilled. • The iteration statements are also called as loops or Looping statements
  • 18. ITERATION OR LOOPING Python provides two kinds of loops & they are, for loop while loop
  • 19. while loop A while loop allows general repetition based upon the repeated testing of a Boolean condition The syntax for a while loop in Python is as follows: while condition: body Where, loop body contain the single statement or set of statements (compound statement) or an empty statement. : Colon Must
  • 20. while loop The loop iterates while the expression evaluates to true, when expression becomes false the loop terminates. FLOW CHART
  • 21. while loop - programs OUTPUT Natural Numbers generation
  • 22. for LOOP  Python’s for-loop syntax is a more convenient alternative to a while loop when iterating through a series of elements.  The for-loop syntax can be used on any type of iterable structure, such as a list, tuple str, set, dict, or file Syntax or general format of for loop is, for element in iterable: body
  • 23. for LOOP OUTPUT Till the list exhaust for loop will continue to execute.
  • 24. for LOOP - range KEYWORD The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified number. Syntax: range(start, stop, step) ---------------------------------------------------------------------- Eg 1: for n in range(3,6): print(n) Eg 2: x = range(3, 6) for n in x: print(n)
  • 25. for LOOP - range KEYWORD OUTPUT #Generating series of numbers
  • 26. Q & A Prepared By : Anub A
  翻译: