2/17/2025 Untitled
In [2]: a,b,c=map(int,input("Enter the sides of the triangle:").split())
if (a==b) and (b==c) and (c==a):
print("Equilateral Triangle")
elif (a==b) or (b==c) or (c==a):
print("Isoceles Triangle")
else:
print("Scalene Triangle")
Equilateral Triangle
In [4]: a,b,c,d=map(int,input("Enter the values a,b,c,d:").split())
x=int(input("Enter the value of x:"))
k=int(input("Enter the value of k:"))
if x > k:
f = a*(x**3) -b*(x**2) + c*x -d
elif x==k:
f=0
elif x < k:
f = -a*(x**3) +b*(x**2) - c*x +d
print(f)
-343
In [9]: w=float(input("Enter the weight in kg:"))
h=float(input("Enter the height in cm:"))
h=h/100
bmi=w/(h**2)
if bmi<=18.4:
print("Underweight")
elif bmi>=18.5 and bmi<24.9 :
print("Normal")
elif bmi>=25.0 and bmi<39.9:
print("Overweight")
elif bmi>=40:
print("Obese")
Underweight
In [19]: choice=str(input("Enter whether distance is in ''in or 'cm'"))
d=float(input("enter distance"))
if(choice=="in"):
d=d/12
print("Distance in feet:",d)
else:
d=d/100
print("Distance in meters:",d)
Distance in feet: 30.0
In [18]: a=str(input("Enter a string"))
print(a)
hello world
In [23]: a=str(input("Enter a string:"))
print(a[1::2])
iaia
file:///C:/Users/Niharika Mahnot/Desktop/jupyter projects/A392_Niharika_Exp2.html 1/2
2/17/2025 Untitled
In [30]: a=str(input("Enter a string:"))
if(a==a[-1::-1]):
print("Palindrome")
else:
print("Not a palindrome")
Palindrome
In [ ]:
file:///C:/Users/Niharika Mahnot/Desktop/jupyter projects/A392_Niharika_Exp2.html 2/2