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

Lab 1 Introduction To Python Programming Solution1

The document is a laboratory manual for an introduction to Python programming course. It provides 4 homework problems for students to write Python programs to calculate mathematical expressions and output the area and perimeter of a rectangle.

Uploaded by

Sudesh Kumar
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)
73 views2 pages

Lab 1 Introduction To Python Programming Solution1

The document is a laboratory manual for an introduction to Python programming course. It provides 4 homework problems for students to write Python programs to calculate mathematical expressions and output the area and perimeter of a rectangle.

Uploaded by

Sudesh Kumar
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

Think Twice

Code Once

The Islamic University of Gaza


Engineering Faculty
Department of Computer Engineering
Fall 2017
LNGG 1003
Khaleel I. Shaheen

Introduction to Computers

Laboratory Manual

Experiment #1 Solution

Introduction to Python Programming


Experiment #1: Introduction to Python Programming

Homework
1. Write a program that displays Welcome to Python, Welcome to Engineering, and
Programming is fun on the screen. Include some comments.
print("Welcome to Python")
print("Welcome to Engineering")
print("Programming is fun")
2. Write a program that displays the result of 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
print(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)
9.5 ∗ 4.5 – 2.5 ∗ 3
3. Write a program that displays the result of 45.5 − 3.5

print((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5))


4. Write a program that displays the area and perimeter of a rectangle with the width of
4.9 and height of 7.5 using the following formulas:

𝑎𝑟𝑒𝑎 = 𝑤𝑖𝑑𝑡ℎ ∗ ℎ𝑒𝑖𝑔ℎ𝑡

𝑝𝑒𝑟𝑖𝑚𝑒𝑡𝑒𝑟 = 2 ∗ 𝑤𝑖𝑑𝑡ℎ + 2 ∗ ℎ𝑒𝑖𝑔ℎ𝑡

print(4.9 * 7.5) # area


print(2 * 4.9 + 2 * 7.5) # perimeter

Good Luck

You might also like