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