Pythoncodes Class9
Pythoncodes Class9
1. Input three numbers and check whether they form a triangle or not.
angle1 = int(input(“input the first angle”))
angle2 = int(input(“input the 2nd angle”))
angle3 = int(input(“enter the 3rd angle”))
sum= angle1+angle2+angle3
if sum==180:
print(“angles can make a triangle”)
else:
print(“angles cannot make a triangle”)
4. Find the result of 22/7*5*5 i.e. the area of circle having radius 5.
r=5
area=3.14*r*r
print(“The area is”, area)
L=int(input(“enter length”))
b=int(input(“enter breadth”))
if (L== b):
print(“it is a square”)
else:
print(“it is not a square”)
6. Input a number between 1 and 7 and display the weekly based on the number.
7)Take a Boolean value ‘false’ and a float number “15.6” and perform the AND
operation on both.
b=False
f=15.6
r=b and f
print (r)
8.) Input Salary and years of service. If the number of years is more than 5 then give an
extra bonus of 15%. Display the net salary after adding the bonus.
9) Take a string ‘zero’ and a Boolean value ‘true’ and try adding both by bool function.
s= “zero”
b=True
r=(s)+str(b)
print(r)
10) Input a billing amount of shopping done. If the amount is more than 5000, then give
a discount of 10%. Display the net billing amount after the discount.
12. Same as 7.
13. Take a string ‘morning’ and float value ‘90.4’ and try adding both of them using the
float() function.
s= “morning”
f=90.5
r=float(s)+f
print(r)