Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Whenever we think of numbers, we are actually thinking of them in relation to some base. Typically that base is 10. Each number can be decomposed as...

Whenever we think of numbers, we are actually thinking of them in relation to some base. Typically that base is 10. Each number can be decomposed as a combination of the powers of it's base.

134 = 1 * 10^2 + 3 * 10^1 + 4 * 10^0

function that takes a number and returns a list of it's decimal representation.

:"""Return a list representing the decimal representation of a number.>>> decimal(55055)[5, 5, 0, 5, 5]>>> decimal(-136)['-', 1, 3, 6]"""

Use OK to test your code:

We can also represent numbers in different bases. Think of how you could represent the number 5 in base 2. Essentially, how can you break the number 5 into powers of 2. It contains one 4 and one 1. In base 2, your digit overflows after 1, so this representation of numbers only has 1 and 0.

5 = 1 * 2^2 + 0 * 2^1 + 1 * 2^0

function that takes a number and returns a list of it's representation in base 2.

:"""Return a list representing the representation of a number in base 2.>>> binary(55055)[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]>>> binary(-136)['-', 1, 0, 0, 0, 1, 0, 0, 0]"""
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question