Advance Python Compressed$20241122125807
Advance Python Compressed$20241122125807
Advance Python Compressed$20241122125807
Input
Process
Output
Variable
A placeholder or a named location to hold or store
the data in memory. Ex: a = 5, b = “hello”
print() and input()
• Syntax:
if <condition or expression>:
Body of If
else:
Body of else
• Decision making statements
• if statement
• if..else statements
• if-elif ladder
if...elif...else Statement
• Syntax
if <condition or expression>:
Body of if
elif <condition or expression>:
Body of elif
else:
Body of else
• The elif is short for else if. It allows us to check for multiple expressions. If
the condition for if is False, it checks the condition of the next elif block
and so on. The if block can have only one else block. But it can have
multiple elif blocks.
• If all the conditions are False, body of else is executed.
for loop
• Syntax
for val in sequence:
Body of for
• range()
– Syntax : range(begin, end, step)
– It is used to iterate over a sequence
of numbers.
while loop