You are asking to develop a “Converting decimal to Binary or hexadecimal” progra

You are asking to develop a “Converting decimal to Binary or hexadecimal” program in Python for a class of sixth-grade students.
The program tell user it can convert any decimal number range 0 to 15 to corresponding binary number or hexadecimal number.
1. Use a function to get an integer between 0 to 15 (assume 0 is an integer) from the user. For any incorrect input, display a reminding message and let user re-enter.
2. Use a function to get the user’s choice,“a” or “b”, from a menu:
a: Converting to Binary
b: Converting to hexadecimal
3. Use a function to convert the input decimal number according user’s choice from step 2, and display the result by a clear message.
4. Ask user if want to convert another decimal number. If the answer is “Yes”, repeat steps 1 to 4 above. If “No”, terminates the program.
How to get higher score for this assignment (Maximum 100 points):
1. Allow a user to play multiple times. For example, using a while loop. Remind the player what input to stop the game.
2. Formatting your outputs and developing your program a user-friendly one.
3. Document your program by adding comments:
a. Introduce/describe the program including the author, date, goal/purpose of the program at the very beginning.
b. Document every variable/function used at the program even the name is meaningful
c. Explain/comment operation/activity/logic of your code. For example, “Checking whether the input is integer from 0 to 15”.
4. (Optional) For any wrong input, use try/except block to tell the player what is wrong and asking to re-enter.
5. Testing your program for all possible inputs. Make sure it runs right and will not get syntax/running error.
Name your program as “YourLastName_FirstInitial_P1.py” and submit it to Blackboard at “Submit Program Here” by or before the due time.

Leave a Comment