COURSE SECTION 03 OF 06
Python Statements and Control Loops
Lesson material assembled from the files you supplied.
Course notes
Content below is transcribed from the supplied course document. The original wording and terminology are retained.
Statement:-
Any instruction written in the source code and executed by the Python interpreter is called a statement. The Python language has many different types of statements like assignment statements, conditional statements, looping statements, etc., that help a programmer get the desired output.
Types of Statement:-
Conditional Statement:-
if Statement:-
if statement
else Statement:-
if-else statement
elif Statement:-
If-elif-else statement
break Statement:-
break with for loop
break statement with while loop
continue Statement
pass Statement
def function(arg):
pass:
Function:-
range() Function
range(start, stop, step size)
range(start-value, stop-value, difference between the values)
next() function:
next() function does is starting from leftmost object within iterator will yielding the values.
Loops:- finite and infinite loop
for loop
for loop with string
while loop
Iterables means collection of other objects
Iterable means an object can be used in iteration
Iterator :- If an object is iterable, it can be passes to built-in Python function iter(), which returns something called an iterator.
Download the supplied Python examples
Topics identified in the course materials
- Statements
- Conditional Statements
- if, else and elif
- break, continue and pass
- Loops