Python File PDF
Python File PDF
Output:
1 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
#area of triangle
a=int(input('Enter the value of base of the triangle'))
b=int(input('Enter the value of height of the triangle'))
print("Area of triangle is",1/2*a*b)
print()
#area of rectangle
l=int(input('Enter the value of length of the rectangle'))
b=int(input('Enter the value of breadth of the rectangle'))
print("Area of Rectangle ",l*b)
print()
#area of parallelogram
2 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
#area of circle
Pi=3.14
r=float(input('Enter the value of radius of circle'))
area= 2*Pi*r*r
print("Area of Circle is",area)
Output
3 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
#Volume of cube
s=int(input('Enter the side of cube'))
print("The volume of cube is",s*s*s)
#Volume of cylinder
a=int(input('Enter the area of Cyclinder'))
h=int(input('Enter the height of Cyclinder'))
print("The volume of cylinder is",a*h)
#Volume of cone
a=int(input('Enter the area of Cone'))
h=int(input('Enter the height of Cone'))
print("The volume of cone is",1/3*a*h)
#Volume of sphere
pi=3.14
r=int(input('Enter the value of radius of Sphere'))
print("The volume of sphere is",4/3*pi*r*r*r)
4 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
5 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
6 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
7 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
8 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
9 | Page
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
10 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
11 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output:
12 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output:
13 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
14 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
while a>0:
k=a*k
a=a-1
sum3=x**j/k+sum3
for j in range (3,n+1,4):
a=j
k=1
while a>0:
k=a*k
a=a-1
sum4=x**j/k+sum4
print("Expression 2: sum=", sum3-sum4)
Output
16 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
def comb(L):
for i in range(3):
for j in range(3):
for k in range(3):
if(i !=j and j !=k and i !=k):
print(L[i],L[j],L[k])
comb([4,5,6])
Output
17 | P a g e
Programming in Python Laboratory Name: Sambhav Gandhi
Subject Code: UGCA 1917 Roll Number: 2102940
Output
18 | P a g e