0% found this document useful (0 votes)
17 views13 pages

Python Programming Practical File

This document is a practical file for a Python programming course at Lucknow Institute of Technology, submitted by a second-year B.Tech student. It contains various Python code snippets for calculating areas, volumes, and performing mathematical operations, as well as implementing control structures like loops and conditionals. The file serves as a compilation of exercises demonstrating the application of Python in solving mathematical problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views13 pages

Python Programming Practical File

This document is a practical file for a Python programming course at Lucknow Institute of Technology, submitted by a second-year B.Tech student. It contains various Python code snippets for calculating areas, volumes, and performing mathematical operations, as well as implementing control structures like loops and conditionals. The file serves as a compilation of exercises demonstrating the application of Python in solving mathematical problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

✦✦✦ PRACTICAL FILE ✦✦✦

LUCKNOW INSTITUTE OF TECHNOLOGY

(Affiliated to AKTU)

────────────────────────────────────────────────────────────────

Subject: PYTHON PROGRAM

Course: [Link](CSE)

Year: 2nd Year

Branch: Computer Science & Engg.

────────────────────────────────────────────────────────────────

Submitted By:

Name: Shiva Kumar Verma

Roll No: 2403620100078

Branch: CSE

Year: 2nd Year

────────────────────────────────────────────────────────────────

Submitted To:

Faculty Name: Priya Gupta

────────────────────────────────────────────────────────────────

✦✦✦ 30/10/2025 ✦✦✦


1. Area of circle

R= float(input("enter the radius"))

pi=3.141

Area=pi*R*R

print("Area of circle is :",Area)

[Link] of cube

S=float(input("enter the side" ))

Area=6*S*S

print(Area)

[Link] of cuboid

L=float(input("enter the lengh :"))

B=float(input("enter the breadth :"))

H=float(input("enter the hight :"))

Area=2*(L*B+B*H+H*L)

print(Area)

[Link] of rectangle

L= float(input("enter the lengh :"))

W=float(input("enter the width :"))

Area=L*W

print(Area)
[Link] of square

S=float(input("enter yhe side :"))

Area=S*S

print(Area)

[Link] of triangle

H=float(input("enter the height :"))

B=float(input("enter the base :"))

Area=H*B/2

print(Area)

[Link] of tsa in right circle cone

R=float(input("enter the radius :" ))

L=float(input("rnter the lenght :"))

pi=3.141

Area=pi*R*(L+R)

print(Area)

[Link] of tsa of cylinder

R=float(input("enter the radius :"))

H=float(input("enter the hight :"))

pi=3.141

Area=2*pi*R*(R+H)

print(Area)
[Link] of sphere

R=float(input("enter the radius :"))

pi=3.141

TSA=4*pi*R*R

print(TSA)

[Link] of cone

R=float(input("enter the radius :"))

H=float(input("enter the hight :"))

pi=3.141

Volume=pi*R*R*H/3

print(Volume)

[Link] of cube

S=float(input("enter the side ;"))

Volume=S*S*S

print(Volume)

[Link] of cubiod

L=float(input("entr the lenght :"))

B=float(input("enter the breadth :"))

H=float(input("enter the hight :"))

Volume=L*B*H

print(Volume)
[Link] of cylinder

R=float(input("enter the redius :"))

H=float(input("enter the hight :"))

pi=3.141

Volume=pi*R*R*H

print(Volume)

[Link] of sphere

R=float(input("enter the radius :"))

pi=3.141

Volume=4*pi*R*R*R/3

print(Volume)

[Link] operator

A=float(input("enter the value of A"))

B=float(input("enter the value of B"))

sum=A+B

print(sum)

sub=A-B

print(sub)

mul=A*B

print(mul)

div=A/B

print(div)

[Link] of rectangle

L=float(input("enter the lenght :"))


W=float(input("enter the width :"))

Perimeter=2*(L+W)

print(Perimeter)

[Link] A TO CITY B

a=input("enter your city :")

b=input("enter your destination :")

time= int(input('enter the time 1 longer or 2 shoter '))

price= int(input("enter the price 1 high or 2 low"))

if time==1 :

if price==1 :

print("you travel in train")

else:

print("you help to coach")

else:

if price==1:

print("you travel in daytime flight ")

else:

print("you travel red eye flight ")

print ("welcome your destination",b)

print("thanks for travel")

a=input("enter your city :")

b=input("enter your destination :")

time= int(input('enter the time 1 longer or 2 shoter '))

price= int(input("enter the price 1 high or 2 low"))


if time==1 :

if price==1 :

print("you travel in train")

else:

print("you help to coach")

else:

if price==1:

print("you travel in daytime flight ")

else:

print("you travel red eye flight ")

print ("welcome your destination",b)

print("thanks for travel")

[Link] of 4 number

A=float(input("enter the value of A:"))

B=float(input("enter the value of B:"))

C=float(input("enter the value of C:"))

D=float(input("enter the value of D:"))

if A>B and A>C and A>D :

print("greater number is A",A)

elif B>A and B>C and B>D :

print("greater number is B",B)

elif A>C and C>B and C>D :

print("greater number is C",C)

else :

print("greater number is D",D)


[Link] NUMBER IN FOR LOOP

i=int(input("enter the number :"))

for j in range (2,i+1,2):

print(j)

[Link] USING FOR LOOP

n=int(input("enter the range :"))

fact=1

for i in range(1,n+1):

fact*=i

print(fact)

[Link] SERIES

n = 10

a, b = 0, 1

print("Fibonacci Series:")

for i in range(n):

print(a)

a, b = b, a + b

[Link] NUMBER

for i in range(1,11):

print(i)
[Link] OF ANY NUMBER

n=int(input("enter the range :"))

i=int(input("enter the number of table :"))

for x in range(1,n+1):

print(x*i)

24.N number print

N=int(input("enter the range : "))

for x in range(1,N+1):

print(x)

[Link] division result

marks=float(input("enter the student marks:"))

if (marks>=80):

print("grade:A")

elif(marks>=60 and marks<=79.9):

print("grade:B")

elif(marks>=50 and marks<=59.9):

print("grade:C")

else:

print("grade:D")

[Link] division result

marks=float(input("enter the student marks:"))

if (marks>=60):

print("first division")

elif(marks>=45):
print("second division")

elif(marks>=33):

print("third division")

else:

print("fail")

27. CHECK THE NUMBER EVEN OR ODD

#Check the number even or odd

N=int(input("enter the number"))

rem=N%2

if (rem/2==0):

print("the number is even")

else:

print("the number is odd")

[Link] TOTAL MARKS AND %

a=float(input("enter the 1st subject marks :"))

b=float(input("enter the 2nd subject marks :"))

c=float(input("enter the 3rd subject marks :"))

d=float(input("enter the 4th subject marks :"))

if a<40:

print("student is fail")

else:

total=a+b+c+d

percentage=(total/4)

print("total marks :", total)

print("percentage of marks :",percentage ,"%")


[Link] 10 time print

h="hello"

i=10

for x in range(1,i+1):

x=h

print(x)

[Link] digit print

num = int(input("Enter a number: "))

lastdigit = num % 10

if lastdigit == 0:

print("The number ends with 0")

elif lastdigit == 5:

print("The number ends with 5")

else:

print(f"The number ends with {lastdigit}")

[Link] prime number

n=int(input("enter the number :"))

for i in range(2,n+1):

for j in range(2,n+1):

if i%j==0:

break

if i==j:

print(i,end=",")
[Link] the number is prime or not prime

n = int(input("Enter the number: "))

for i in range(2, n+1):

if n % i == 0:

print(n, "is not a prime number")

break

else:

print(n, "is a prime number")

[Link] multiplication for loop

r1=[1,2,3]

r2=[4,5,6]

r3=[7,8,9]

s1=[1,2,1]

s2=[6,2,3]

s3=[4,2,1]

A=[]

B=[]

[Link](r1)

[Link](r2)

[Link](r3)

[Link](s1)

[Link](s2)

[Link](s3)

C=[[0,0,0],[0,0,0],[0,0,0]]

dim=3

#c[2][1]is the dot product of the 2nd row of a and the end
#frist colum of b

for i in range(dim):

for j in range(dim):

for k in range(dim):

C[i][j]+=A[i][k]*B[k][j]

print(C)

You might also like