Skip to content

Ankit-Khule/Conditonal-Statements-Looping-Constructs-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conditonal-Statements & Looping Constructs-in-Python

  • In python there are no brackets present for writing loops or conditional statment, instead we use indentation to represent the part inside a condition or loop.

  • It will throw an error if proper indentation is not present. or if multiple loops are there withou proper indentation a function can be outside the loop.

  • Python consist of control statements

    • continue - this will return the control to the beginning of the loop
    • break - this will break the loop and brings control out of the loop.
    • pass - it will let the loop continue and do nothing. used mostly in exception handling or running some empty loop.

Below are the most used condtional statements and looping contructs:

  • If Else: if-else

  • if -elif- else if-elif

  • Nested If else nestedif-else

  • short hand if-else shorthandif-else

  • While loop While

  • Nested while loop NestedWhile

  • control statements used in while loop

  • pass pass

  • break break

  • continue continue

  • For loop For

  • Nested for Loop NestedFor

  • range function in for loop range

Releases

No releases published

Packages

No packages published