MF: I want to review/revise. (potentially into a 1-page lab? maybe not...)
Pages or lab needs renaming so they aren't duplicative. --MF, 6/15/20
On this page, you will generalize from base conversion with binary to conversion with any base.
Here's one solution for binary conversion of non-negative integers:
If a number can be represented with only a single digit, we use it as the base case. For binary, the only numbers that can be represented with a single digit are 0 and 1, so we test to see if the number is less than 2. If so, we report it.
join
because we want to string the digits together.
base7
block, which displays a number in base 7.base
block that takes the base as a second input:from base
that takes a (text) string of digits and a base as inputs, and reports the corresponding number.base
block so that it can go up to base 36 by using the letters a
‒z
as digits with values 10‒35.from base
block to support bases up to 36 in the same manner.