0% found this document useful (0 votes)
13 views

10 If Programs Of Python

Programs on phython

Uploaded by

takuljuha
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 views

10 If Programs Of Python

Programs on phython

Uploaded by

takuljuha
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/ 11

10 If Programs Of Python

 1stprogram

Input:
marks=int(input("enter your final test marks"))
if marks>=99:
print("You will get a new phone.")
elif marks>=95 and marks<=98:
print("Study hard and get good marks next time or I will kick you out
of the house")
else:
print("You are grounded for a month and no iPad")

Output
1stcase-
enter your final test marks100
You will get a new phone.
2ndcase-
enter your final test marks97
Study hard and get good marks next time or I will kick you out
of the house.
3rdcase-
enter your final test marks94
You are grounded for a month and no iPad.
 2ndprogram

Input:
v=int(input("Select your method of transportation number
present in the box{(3)car,(2)bus,(1)cycle):"))
if v>2:
print("You will reach to the location quickly but you increase
the pollution the in air.")
elif v>1 and v<3:
print("Great job you are protecting your environment.")
else:
print("You are going to be in good health but remember to
take your raincoat during rainy season.")

Output:
1stcase-
Select your method of transportation number present in the
box{(3)car,(2)bus,(1)cycle):1
You are going to be in good health but remember to take your
raincoat during rainy season.
2ndcase-
Select your method of transportation number present in the
box{(3)car,(2)bus,(1)cycle):2
Great job you are protecting your environment.
3rdcase-
Select your method of transportation number present in the
box{(3)car,(2)bus,(1)cycle):3
You will reach to the location quickly but you increase the
pollution the in air.
 3rdprogram

Input:

x=int(input("enter first no:"))


y=int(input("enter second no:"))
if x==y:
print("equal")
else:
print("unequal")

Output:

1stcase-

enter first no:5


enter second no:5
equal

2ndcase-

enter first no:4


enter second no:7
unequal
 4thprogram

Input:

n=int(input("enter a no :"))
r=n%2
if r==0:
print("even")
else:
print ("odd")

Output:

1stcase-

enter a no :3
odd

2ndcase-

enter a no :98345678
even
 5thprogram

Input:

x= int(input("Enter number ="))


if x > 0 :
print("Number is positive")
if x==0:
print("Number is zero")
else:
print("Number is negative")

Output:

1stcase-

enter number =29


Number is positive

2ndcase-

enter number =-30


Number is negative

3rdcase-

enter number =0
Number is zero
 6thprogram

Input:

yr=int(input("enter year"))
if yr%100==0:
if yr%400==0:
print("leap year")
else:
print("not a leap year")
else:
if yr%4==0:
print("leap year")
else:
print("not a leap year")

Output:

1stcase-

enter year 1900


not a leap year

2ndcase-

enter year 2028


leap year
 7thprogram

Input:

l=int(input("length= "))
b=int(input("breadth= "))
if l==b:
print("it is a square")
else:
print("it is a rectangle")

Output:

1stcase-

length= 4
breadth= 4
it is a square

2ndcase-

length= 6
breadth= 9
it is a rectangle
 8thprogram

Input:

age=int(input("enter the age of the voter"))


if age>=18:
print("eligible")
else:
print("not eligible")

Output:

1stcase-

enter the age of the voter18


eligible

2ndcase-

enter the age of the voter15


not eligible
 9thprogram

Input:

a=float(input("enter one side"))


b=float(input("enter second side"))
c=float(input("enter third side"))
if a+b>c and a+c>b and b+c>a:
print("possible")
else:
print("not possible")

Output:

1stcase-

enter one side3


enter second side4
enter third side5
Possible

2ndcase-

enter one side4


enter second side4
enter third side9
not possible
 10thprogram

t= int(input("enter temp.= "))


if t<=0:
print("ice")
if t>0 and t<=100:
print("water")
if t>100:
print("steam")

Output:

1stcase-

enter temp.= 90
water

2ndcase-

enter temp.= 121


steam

3rdcase-

enter temp.= -200


ice

You might also like