## Homework 4 - due Wednesday, April 29, before class

#### 1) Binary Numbers

Convert the following numbers from binary representation to decimal representation:

- 10 - 2
- 1001 - 9
- 1111 - 15

Convert the following numbers from decimal representation to binary representation:

- 5 - 101
- 0 - 0
- 70 - 1000110

Convert the following numbers from hexadecimal representation (base 16) to decimal representation:

- A - 10
- 23 - 35
- FF - 255

#### 2) Power

Write a recursive function that raises a number to a power. The
function should have two parameters: the number to be raised and the
exponent. (You can assume that the exponent is a non-negative
integer.) For example, let's say the name of the function is
`power`, then `power(3,2)` should return 9 (3 * 3),
`power(3,3)` should return 27 (3 * 3 * 3), and
`power(2,4)` should return 16 (2 * 2 * 2 * 2). So, the second
parameter controls the recursion.

#### 3) Recursive Pyramid

Write a recursive function that draws the following picture:

Note that this pyramid is built from square building blocks (not triangular ones even though it may look like it). The following two pictures attempt to show that the structure is based on squares. The picture on the left is a close up of a part of the pyramid, which shows that the base case is just a plain square. The picture on the right shows how the whole structure breaks down into three equal squares and how each of those squares breaks down into three equal squares etc.

#### 6) Submit

Upload all of your python programs and answers to the questions to Blackboard.