0% found this document useful (0 votes)
14 views3 pages

Python Practical File

The document provides Python programs for various mathematical conversions and calculations, including temperature conversions, area and perimeter of shapes, division, marks calculation, journey time, interest calculations, and time conversion. Each program includes sample input and output to demonstrate functionality. The examples cover a range of basic programming concepts suitable for beginners.

Uploaded by

rajni.chaubey76
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)
14 views3 pages

Python Practical File

The document provides Python programs for various mathematical conversions and calculations, including temperature conversions, area and perimeter of shapes, division, marks calculation, journey time, interest calculations, and time conversion. Each program includes sample input and output to demonstrate functionality. The examples cover a range of basic programming concepts suitable for beginners.

Uploaded by

rajni.chaubey76
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

Q1.

Convert Celsius → Fahrenheit


Python Program Sample Output
celsius = float(input("Enter temperature in Enter temperature in Celsius: 25
Celsius: ")) Temperature in Fahrenheit: 77.0
fahrenheit = (9/5) * celsius + 32
print("Temperature in Fahrenheit:",
fahrenheit)

Q2. Convert Fahrenheit → Celsius


Python Program Sample Output
fahrenheit = float(input("Enter temperature Enter temperature in Fahrenheit: 98.6
in Fahrenheit: ")) Temperature in Celsius: 37.0
celsius = (5/9) * (fahrenheit - 32)
print("Temperature in Celsius:", celsius)

Q3. Rectangle Area & Perimeter


Python Program Sample Output
length = float(input("Enter length of Enter length of rectangle: 10
rectangle: ")) Enter breadth of rectangle: 5
breadth = float(input("Enter breadth of Area of rectangle: 50.0
rectangle: ")) Perimeter of rectangle: 30.0
area = length * breadth
perimeter = 2 * (length + breadth)
print("Area of rectangle:", area)
print("Perimeter of rectangle:", perimeter)

Q4. Square Area & Perimeter


Python Program Sample Output
side = float(input("Enter side of square: Enter side of square: 6
")) Area of square: 36.0
area = side * side Perimeter of square: 24.0
perimeter = 4 * side
print("Area of square:", area)
print("Perimeter of square:", perimeter)

Q5. Circle Area & Circumference


Python Program Sample Output
import math Enter radius of circle: 7
radius = float(input("Enter radius of Area of circle: 153.93804002589985
circle: ")) Circumference of circle:
area = [Link] * radius * radius 43.982297150257104
circumference = 2 * [Link] * radius
print("Area of circle:", area)
print("Circumference of circle:",
circumference)
Q6. Division (Quotient)
Python Program Sample Output
a = float(input("Enter first number: ")) Enter first number: 20
b = float(input("Enter second number: ")) Enter second number: 4
quotient = a / b Quotient = 5.0
print("Quotient =", quotient)

Q7. Marks of 3 Subjects


Python Program Sample Output
cs = float(input("Enter marks in Computer Enter marks in Computer Science: 90
Science: ")) Enter marks in Mathematics: 85
maths = float(input("Enter marks in Enter marks in Physics: 95
Mathematics: ")) Total Marks = 270.0
physics = float(input("Enter marks in Percentage = 90.0 %
Physics: "))

total = cs + maths + physics


percentage = (total / 300) * 100

print("Total Marks =", total)


print("Percentage =", percentage, "%")

Q8. Sum & Product of 4 Numbers


Python Program Sample Output
a = float(input("Enter first number: ")) Enter first number: 2
b = float(input("Enter second number: ")) Enter second number: 3
c = float(input("Enter third number: ")) Enter third number: 4
d = float(input("Enter fourth number: ")) Enter fourth number: 5
Sum = 14.0
total = a + b + c + d Product = 120.0
product = a * b * c * d

print("Sum =", total)


print("Product =", product)

Q9. Time Taken for a Journey


Python Program Sample Output
distance = 450 # fixed Enter average speed of car (km/h): 90
speed = float(input("Enter average speed of Time taken to cover 450 km is 5.0 hours
car (km/h): "))
time = distance / speed
print("Time taken to cover", distance, "km
is", time, "hours")

Q10. Simple & Compound Interest


Python Program Sample Output
p = float(input("Enter Principal amount: ")) Enter Principal amount: 1000
r = float(input("Enter Rate of Interest: ")) Enter Rate of Interest: 10
t = float(input("Enter Time (years): ")) Enter Time (years): 2
Simple Interest = 200.0
# Simple Interest Compound Interest = 210.0
si = (p * r * t) / 100

# Compound Interest
ci = p * ((1 + r/100) ** t) - p

print("Simple Interest =", si)


print("Compound Interest =", ci)

Q11. Minutes → Hours & Minutes


Python Program Sample Output
minutes = int(input("Enter time in minutes: Enter time in minutes: 135
")) 135 minutes = 2 hours and 15 minutes
hours = minutes // 60
remaining_minutes = minutes % 60
print(minutes, "minutes =", hours, "hours
and", remaining_minutes, "minutes")

You might also like