question archive For most of your life, you have used the base-10 numeral system

For most of your life, you have used the base-10 numeral system

Subject:Computer SciencePrice: Bought3

For most of your life, you have used the base-10 numeral system. You count 0, 1, 2, 3, ... , 9, 10, 11, 12 and so on. You may not have realized it, but 11 means one "10" and one "1". However, we are not limited to just base-10. Binary is the name given to the number system used in most computing systems, and the "0" can stand for "no signal," and the "1" can stand for "signal present."

A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression that uses only two symbols: typically "0" (zero) and "1" (one). Each digit is referred to as a bit or binary digit. Using this binary numeral system, it is possible to build all the logic gates used in modern digital computers and devices. Text, colors, and sounds can be encoded using binary numbers. However, long strings of 0's and 1's are hard for humans to read, so we sometimes use hexadecimal numbers (base-16) to represent their binary equivalent. Hexadecimal symbols are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

Use Repl.it to write a Python program that asks the user to provide a decimal number between 0 and 255 and provide the binary and hexadecimal equivalents. When the user is done converting numbers, they can enter "X" or "x" to exit the converting dialogue. The application will exit, provide a "Thank you" dialogue, and produce a table of the first 256 (0 to 255) values of the decimal, binary, and hexadecimal number systems for the user to have as a handy reference.

You can use the built-in conversion functions for converting decimal numbers to binary and hexadecimal for now. We will learn how to make our own functions in a later module. Below are some useful examples. "binOut" is variable, bin() is the built-in function that returns a string, the next line is a print statement that prints the string, omitting the first two characters. upper() is a method that converts a string to upper case characters.

  • binOut = bin(userInput)
  • print(binOut[2:])
  • hexOut = hex(userInput).upper()
  • print(hexOut[2:])
  • After your standard docstring at the top of your program, use comments to list the major steps of your algorithm for this program.
  • Include a "Welcome" dialogue, and provide instructions if requested.
  • Make sure you comment on your code adequately and use good programming practices.
  • Save your program with the fileName "lastName U3AE.py" and upload your file to this assignment.
  • The attached file contains a sample interaction between a user and the program (only the first 14 lines of the table). Your results do not have to be exactly like the sample, be creative. However, your user experience should be similar.
  • PEA Running Please provide the name you would like to use for this session: Jeff Hello, Jeff. welcome to the Value Conversion Application (PEA). Do you need instructions Jeff? (YIN): y The application will ask you for decimal value that is between 3 and 255. Please enter the value and hit the Enter key. The application will repond with the binary and hexadecimal equivalents. The application will continue to ask you for values to convert. When you are ready to exit, enter the letter 'x'. Upon exiting, the application will print a handy conversion table. When you are ready to start converting values, hit the Enter key. Please enter a positive integer to convert (enter 'x' to end): 123 Results: 123 equals 13333333 in Binary, and B3 in Hexadecimal notation. Please enter a positive integer to convert [enter 'x' to end): 32 Results: 32 equals 133333 in Binary, and 23 in Hexadecimal notation. Please enter a positive integer to convert {enter 'x' to end): x Thank you Jeff for using the VCR. Here is a handy table: Handy Dandy Decimal Binary Hexadeciaml Conversion Table MDC?h-IIU'LthI-WNI-'E' H H H N H a D n m b w m q d m e w M H c [.3 W

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE