Week 1: Exercises

This is a set of optional programming tasks that you should be able to implement in Python.

I've included sample output below each task. (In some cases the sample output contains several program runs, separated by ===.)

1. Paint

Read integers representing the width, length and height of a room in meters, and print out the number of square meters of paint required to paint the walls and ceiling (but not the floor).

Width: 5
Length: 8
Height: 4
You need 144 square meters of paint.

2. The Greater Number

Read two integers X and Y and report which is greater (or that they are equal).

Enter X: 4
Enter Y: 6
Y is greater

3. Quotient

Read two integers X and Y, and print their quotient if X is exactly divisible by Y, or "indivisible" otherwise.

Enter X: 8
Enter Y: 2
8 divided by 2 is 4
===
Enter X: 10
Enter Y: 3
indivisible

4. Largest of Three

Read three integers, and print out the largest of them.

Enter X: 4
Enter Y: 17
Enter Z: 2
The largest is 17.