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

Python_Basic_Programs

The document contains basic Python programs for calculating the area of a rectangle and a circle, total and percentage of marks for five subjects, converting feet to inches, converting Fahrenheit to Celsius, and calculating the volume of a cylinder. Each program prompts the user for input and displays the result. These examples serve as practice exercises for beginners in Python programming.

Uploaded by

sheikhasan2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python_Basic_Programs

The document contains basic Python programs for calculating the area of a rectangle and a circle, total and percentage of marks for five subjects, converting feet to inches, converting Fahrenheit to Celsius, and calculating the volume of a cylinder. Each program prompts the user for input and displays the result. These examples serve as practice exercises for beginners in Python programming.

Uploaded by

sheikhasan2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Programs - Basic Practice

1. Area of Rectangle

l = int(input("Enter length: "))


b = int(input("Enter breadth: "))
area = l * b
print("Area of rectangle:", area)

2. Area of Circle

r = int(input("Enter radius: "))


area = 3.14 * r * r
print("Area of circle:", area)

3. Total and Percentage of 5 Subjects

name = input("Enter student name: ")


n1 = int(input("Enter marks of subject 1: "))
n2 = int(input("Enter marks of subject 2: "))
n3 = int(input("Enter marks of subject 3: "))
n4 = int(input("Enter marks of subject 4: "))
n5 = int(input("Enter marks of subject 5: "))
total = n1 + n2 + n3 + n4 + n5
percentage = total / 5
print("Total marks:", total)
print("Percentage:", percentage)

4. Feet to Inches Conversion

feet = int(input("Enter distance in feet: "))


inches = feet * 12
print("Distance in inches:", inches)

5. Fahrenheit to Celsius Conversion

f = int(input("Enter temperature in Fahrenheit: "))


c = (f - 32) * 5 / 9
print("Temperature in Celsius:", c)

6. Volume of Cylinder

r = int(input("Enter radius of cylinder: "))


h = int(input("Enter height of cylinder: "))
volume = 3.14 * r * r * h
print("Volume of cylinder:", volume)

You might also like