0% found this document useful (0 votes)
13 views4 pages

2 Introduction

Uploaded by

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

2 Introduction

Uploaded by

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

If condition

a =100

b = 100

if a>b:

print (a,'Greater than ', b)

elif b>a:

print (b,'Greater than',a)

else:

print (a,'and ',b ,'are equal')

If condition Between

a =300

if a <100:

print (a,'Less than 100')

elif (100<= a <=200):

print (a,'is between 100 and 200')

else:

print (a,'Greater than 200')

Inside If

a =40

if a <100:

print (a,'Less than 100')

if (50<= a <=100):

print (a,'is between 50 and 100')

elif (20<= a <=50):

print (a,'is between 20 and 50')

else:
print (a,'is less than 20')

elif (20<= a <=200):

print (a,'is between 50 and 200')

else:

print (a,'Greater than 200')

Example 2

a = 150

b = 200

if a<b:

print (a,'is smaller than',b)

if 10 <= a <=100:

print (a,'is between 10 and 100')

elif a<10:

print (a,'is less than 10')

else:

print (a,'is bigger number than',b)

While loop

a =1

while a <5:

print ( 'The number is ',a)

a+=1

print ('Program end')

Example 2

x=2

print ('Loop Start')

while x < 10:

print (x)

x +=1
print ('Loop End ')

For Loop

A = [10,15,20,25]

for i in range (len(A)):

print (i)

print ('Good Day')

A = [10,15,20,25]

for i in A:

print (i)

print ('Good Day')

Nested loop

for i in range (10):

print (str(i)*i)

print ('Good Day')

Example 2

A = ['Pen','Pencil','Book','Toy']

B = ['School', 'College']

for i in A:

print (i)

for j in B:

print(' ',j)

Input Parameter

no1 = input ('Enter the value')

no2 = input ('Enter the value')

print ('Data type of no1 ',type (no1))


no3 = int(no1)+ int (no2)

print (no3)

me)

You might also like