0% found this document useful (0 votes)
21 views2 pages

Python Assignment Basics

The document outlines a Python programming assignment with various tasks including displaying messages, performing arithmetic expressions, calculating rectangle area and perimeter, converting Celsius to Fahrenheit, converting miles to kilometers, and computing the surface area and volume of a cylinder. Each task includes example code and expected output. The assignment aims to reinforce basic programming concepts and mathematical calculations.

Uploaded by

rsattirehan
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)
21 views2 pages

Python Assignment Basics

The document outlines a Python programming assignment with various tasks including displaying messages, performing arithmetic expressions, calculating rectangle area and perimeter, converting Celsius to Fahrenheit, converting miles to kilometers, and computing the surface area and volume of a cylinder. Each task includes example code and expected output. The assignment aims to reinforce basic programming concepts and mathematical calculations.

Uploaded by

rsattirehan
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

Python Programming Assignment

1. Program to display messages

Code prints welcome messages on the screen.

Output:

Welcome to Python

Welcome to Engineering

Programming is fun

2. Expression Result

Expression: 2 + 15 * 2 / 2

Output: 17.0

3. Expression Calculation

Expression: (10 + 5) * 2

Output: 30

4. Parentheses Change

Original: 6 * 1 - 2 = 4

Modified: 6 * (1 - 2) = -6

5. Rectangle Area & Perimeter

Width = 4.9, Height = 7.5

Area = 36.75

Perimeter = 24.8

6. Celsius to Fahrenheit

Formula: (9/5) * celsius + 32

Example Output: 77.0°F

7. Miles to Kilometers

Formula: miles * 1.609

Example Output: 8.045 km


8. Cylinder Area & Volume

Surface Area = 2πr² + 2πrh

Volume = πr²h

You might also like