Professional Documents
Culture Documents
I037 - Manas Patel Experiment02
I037 - Manas Patel Experiment02
I037 - Manas Patel Experiment02
PRACTICAL 2
0-100 – 3% 5%
101-200 5% 8% 10%
PRACTICAL 2
1|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
b. Multiple Choice
2|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
1. CODE:
#Triangle Equilateral OR Isoceles OR Scalene
if (s1==s2==s3):
3|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
print("Equilateral Triangle")
elif ((s1==s2)or(s2==s3)or(s1==s3)):
print("Isosceles Triangle")
else:
print("Scalene Triangle")
OUTPUT:
2. CODE:
#Function and print f(x)
import math
#from math import pow
4|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
if (x>k):
f=(a*(x**3))-(b*(x**2))+(c*x)-d
print("x is more than k")
elif (x==k):
f=0
print("x is equal to k")
else:
f=-a*math.pow(x,3)+b*math.pow(x,2)-(c*x)+d #a*pow(a1,b1)
print("x is less than k")
OUTPUT:
5|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
3. CODE:
#Calculator
if (op=="+"):
print("The sum of numbers is ",num1+num2)
elif (op=="-"):
print("The difference of numbers is ",num1-num2)
elif (op=="*"):
print("The product of numbers is ",num1*num2)
elif (op=="/"):
if (num2==0):
print("Division Not Possible")
else:
print("The division of numbers is ",num1/num2)
elif (op=="%"):
print("The modulus of numbers is ",num1%num2)
else:
print("Invalid Input")
OUTPUT:
6|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
4. CODE:
#Bill Amount and Discounts
7|Page
SVKM’s NMIMS University
Mukesh Patel School of Technology Management & Engineering
net_amt=amt-(amt*0.15);
else:
print("Amount:",amt)
if (item=="s"):
net_amt=amt-(amt*0.18);
elif (item=="p"):
net_amt=amt-(amt*0.2);
elif (item=="t"):
net_amt=amt-(amt*0.22);
print("Net Amount:",net_amt)
OUTPUT:
3. Conclusion (Learning Outcomes): The learnings after the practical is about the
conditional looping statement which includes if-statement, if-elif statement and elif ladder
which is helpful in making decision-based syntax for user.
8|Page