Program Development

There are several full length programs in the book. I would like you to copy these pieces of code and get them to run. Your code must have the following template:

# File:

# Description:

# Name:

# Date:

def main():
  # the body of the program

Each program will be in a file by itself with .py extension. You must make sure that it runs as shown in the book.

After you have made sure all the programs run on the command line, zip all the files together into a single file called:
Substitute your UT EID for the place holder myuteid in the file name. Upload the zip file to the turnin system. Do not upload the files individually. We must receive the zip file by 11 PM on Wednesday, 26 June 2013.

Number Conversions

These are exercises that you do. You do not have to turn these in.

  1. Convert the following numbers in decimal to 8-bit 2's complement binary: 28, -39
  2. Write the binary equivalent of all numbers from 0 to 15 in 4-bit binary.
  3. These are 8-bit 2's complement binary. What decimal numbers do they represent?
  4. Convert the following numbers to unsigned binary, octal, and hexadecimal: 25, 32, 67, 96.
  5. Convert these numbers in octal to binary, decimal, and hexadecimal: 672, 215.
  6. Convert these hexadecimal numbers into binary, octal, and decimal: 2A5, D0C.
  7. The hexadecimal number B4 is a 2's complement number in 8-bit binary. Convert it to decimal.
  8. Add 3D and F5 and express the answer in octal.
  9. Add 517 in octal to 3A in hexadecimal and express the answer in decimal. [Hint convert both numbers to binary and add.]
  10. Add the following 2's complement 8-bit numbers: 1011 1001 and 1110 0110. Ignore the overflow bit. Express the answer in decimal.