Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

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

Quiz #3
The Islamic University of Gaza Student Name: _____________________
Engineering Faculty Student ID: ________________________
Department of Computer Engineering Introduction to Computers
Fall 2017 LNGG 1003
Khaleel I. Shaheen

Quiz #3

Solve the following questions in PyCharm on your laptop.


Question 1) Write a program that prompts the user to enter the side of a hexagon and displays
3
√3 2
its area. The formula for computing the area of a hexagon is 𝐴 = 𝑠 where s is the length
2
of a side.

Question 2) Write a Python program that uses an if statement to find the smallest of three
given integers. (The user should enter the three numbers).

Question 3) Write a program that reads an unspecified number of integers, determines how
many positive and negative values have been read, and computes the average of the input
values. Your program ends with the input 0. Print the average in float format.

Question 4) Write a function that computes the sum of the digits in an integer. Use the
following function header:
def sum_digits(n):

For example, sum_digits(234) returns 9, which is the sum of 2 + 3 + 4.

Do the best,
Forget the rest.

You might also like