Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.79 KB

Class1.md

File metadata and controls

38 lines (31 loc) · 1.79 KB

Class 1: Monday, March 20 – Number Bases

Topics:

Resources:

Challenges:

  • practice conversions on number bases worksheet
  • implement base conversion functions for positive numbers using starter code:
    • implement decode - convert a number from any base to base 10
    • implement encode - convert a number from base 10 to any base
    • implement convert - convert a number from any base to any other base
    • run python bases.py number base1 base2 to test convert on a number
      • example: python bases.py 42 10 2 gives the result 101010
    • run pytest test_bases.py to run the unit tests and fix any failures

Stretch Challenges:

  • implement base conversion for negative binary numbers (using two's complement)
  • implement base conversion for fractional numbers (using a radix point)