Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

Class 3 - Python

Uploaded by

Nilanjana Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Class 3 - Python

Uploaded by

Nilanjana Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

If-else Statement

If
Marks>70: else
Get Ice Cream Give Practice Test
Pseudo-Code: if-else

If(condition):

Statements to be executed….

else:

Statements to be executed…..
Looping Statements

Get your salary credited


at the end of each month
While Loop

Enter While loop

Test Expression SYNTAX

while condition:
Exit While loop Execute Statements
True

Body of While
For Loop

For Loop is used to iterate over a sequence (tuple, list, dictionary…..)

For loop syntax

for val in sequence:


body of for loop
Functions

Function (Recipe): A function like a recipe is a set of instructions that perform a specific task or operation.
Just like a recipe, a function has a name and can take inputs (ingredients) and produce an output (result).

Input(Ingredients): The Output (Result): It is the


values given to a function result obtained from the
like bread, tomato etc. function like Sandwich.

Functions can be reused multiple times, just like a recipe can be used to make the
same dish repeatedly. They allow us to write code once and use it in different parts of a
program.
Python Functions

Function is a block of code which performs a specific task


Python Lambda Functions

A small anonymous function , taking any number of arguments, having one expression

You might also like