Professional Documents
Culture Documents
PROGRAM CODE:
#IF-Else
print("Enter a & b")
a=float(input())
b=float(input())
if a>b:
print(a,"is maximum")
else:
print(b,"is maximum")
1
percentage = float(input("enter percentage: "))
if 60 <= percentage :
print("first class")
elif 50 <= percentage:
print("second class")
elif 40 <= percentage:
print("Pass")
elif percentage < 40:
print("Fail")
else:
print("input valid percentage")
#While
i=1
while i<=10:
print(i)
i+=1
i=2
while i<=10:
print(i)
i+=2
i=1
while i<=10:
print(i*5)
i+=1
i=1
while i<=2:
print(i)
i+=0.1
i=5
while(i>=0) :
2
print(i)
i-=1
#For loop
for i in range(1,6):
print(i)
for i in range(5,0,-1):
print(i)
for i in range(1,6,1):
if i==3:
print("in")
continue
print("out")
print(i)
for i in range(1,11,1):
print(i*10)
for i in range(1,6):
print("X"*i)
for i in range(5,0,-1):
print("X"*i)
word=input("Enter word:")
for i in range(1, len(word)+1):
print(" " * (i - 1), word)
4
5
6
7
CONCLUSION:
We Learned To implement Control Statement like if
else, While, for loop
8
9