Python Programming Assignment
Name: ____________________________
Roll No: ____________________________
Class: ____________________________
Subject: Programming Fundamentals (Python)
Teacher: ____________________________
Submitted By: Student
Question 1: Display Messages
# Display welcome messages
print("Welcome to Python")
print("Welcome to Engineering")
print("Programming is fun")
Output:
Welcome to Python
Welcome to Engineering
Programming is fun
Question 2: Expression Result
result = 2 + 15 * 2 / 2
print(result)
Output: 17.0
Question 3: Expression Calculation
result = (10 + 5) * 2
print(result)
Output: 30
Question 4: Change Expression Value
result = 6 * (1 - 2)
print(result)
Output: -6
Question 5: Rectangle Area and Perimeter
width = 4.9
height = 7.5
area = width * height
perimeter = 2 * (width + height)
print("Area:", area)
print("Perimeter:", perimeter)
Output:
Area: 36.75
Perimeter: 24.8
Question 6: Celsius to Fahrenheit
celsius = 25
fahrenheit = (9/5) * celsius + 32
print(fahrenheit)
Output: 77.0
Question 7: Miles to Kilometers
miles = 5
kilometers = miles * 1.609
print(kilometers)
Output: 8.045
Question 8: Cylinder Area and Volume
import math
radius = 3
height = 5
surface_area = 2 * [Link] * radius * radius + 2 * [Link] * radius * height
volume = [Link] * radius * radius * height
print("Surface Area:", surface_area)
print("Volume:", volume)
Output:
Surface Area: 150.79
Volume: 141.37