Python Concept
Python Concept
1985- 1990.
Python is Open source.
Python is Object-Oriented
repetition
Syntax:-
for variable in
range(start,condition,stepping) :
#body
Range():- Take three parameters
1st as starting point
2nd as condition point
3rd as stepping/increment/decrement
FOR LOOP:-
Example:- to print 5’s table
a=5
for i in range(1,11):
print(a, “*”,i “=”,a*i)
Output:-
5*1=5 5*6=30
5*2=10 5*7=35
5*3=15 5*8=40
5*4=20 5*9=45
5*5=25 5*10=50
WHILE LOOP:-
Loops are used to do repetitions until given
condition become false.
This loop is use when we do not know number
of repetition
Syntax:-
initialization
while condition:
#body
increament/decreament
WHILE LOOP:-
Example:- to print 5’s table
a=5
i=0
While i<=10:
print(a, “*”,i “=”,a*i)
Output:-
5*1=5 5*6=30
5*2=10 5*7=35
5*3=15 5*8=40
5*4=20 5*9=45
5*5=25 5*10=50
FUNCTIONS:-
A functions is a block of code, that only runs
when we call it.
We can pass data as parameters into
function.
When a function runs , it takes data as
hello
how are u?
Thank you