0% found this document useful (0 votes)
42 views

Python 3 Practical

The document contains 7 Python programs to perform common calculations: 1) Convert USD to INR, 2) Convert between bits, bytes, MB, GB, TB, 3) Calculate square root, 4) Find rectangle area, 5) Find square area and perimeter, 6) Calculate cylinder volume and surface area, 7) Swap values of two variables.

Uploaded by

sayalimundhe188
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Python 3 Practical

The document contains 7 Python programs to perform common calculations: 1) Convert USD to INR, 2) Convert between bits, bytes, MB, GB, TB, 3) Calculate square root, 4) Find rectangle area, 5) Find square area and perimeter, 6) Calculate cylinder volume and surface area, 7) Swap values of two variables.

Uploaded by

sayalimundhe188
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

1. Write a program to convert U.S.

dollars to Indian rupees

dollar=int(input("enter amount"))

rupees=dollar*80

print("amount is in rupees",rupees)

2. Write a program to convert bits to Megabytes, Gigabytes and Terabytes

bit=int(input("enter value of bit"))

byte=bit/8

mb=byte/1024

gb=mb/1024

tb=gb/1024

print("value in megabyte is=",mb)

print("value in Gigabyte is=",gb)

print("value in Terabyte is=",tb)


3. Write a program to find the square root of a number

num=float(input("enter a number"))

sqrt=num**0.5

print("square root of given no. is=",sqrt)


4. Write a program to find the area of Rectangle

length=int(input("value of length is ="))

width=int(input("value of width is="))

area=length*width

print("area of rectangle is=",area)

5. Write a program to calculate area and perimeter of the square

side=int(input("value of side is="))

area=side*side

print("area of square is=",area)

perimeter =side*4

print("perimeter of square is=",perimeter)


6. Write a program to calculate surface volume and area of a cylinder.

radius=int(input("value of radius is ="))

hight=int(input("value of hight is="))

pi=3.14

volume=pi*(radius*radius)*hight

print("volume of cylinder is=",volume)

surfacearea=(2*pi*radius*hight)+(2*pi*(radius*radius))

print("surface area of cylinder is=",surfacearea)


7. Write a program to swap the value of two variables

a=int(input("value of a is="))

b=int(input("value of b is="))

print("value of a before swapping=",a)

print("value of b before swapping=",b)

temp=a

a=b

b=temp

print("value of a after swapping=",a)

print("value of b after swapping=",b)

You might also like