How do I write a Python Program that will take a numeric input from the user (only values between0-255)?

October 15, 2011 – 4:00 pm

And make it print out the input in decimal, hex, and binary?

Related posts:

  1. Python Help. 1.Write python code that prompts the user to enter his or her height and assigns the user's input?
  2. How does one write a Java program to convert deimal number to binary using dialog boxes for input?
  3. In python, how to accept input and print the input AND raw_input?
  4. Python 3.1.3 How to tell the user to input an integer number?
  5. Can someone write me a program for python that deals the user 1 card from a deck?
  6. Write a Java application that lets the user input a sequence of integers terminated?
  7. I need help writing a python program that converts decimal to binary notation?
  8. Python : How do I detect, if user didnt type anything for user input?
  9. Write python code that will write 100 randomly-generated values between 1 and 19, inclusive, to a file called?
  10. How do you measure the number of times a user enters input in python?
  1. One Response to “How do I write a Python Program that will take a numeric input from the user (only values between0-255)?”

  2. i would use an in range comparison, then print using dec, hex, and, bin functions:

    x = input("please input a number (0-255)")
    if x in range(0,256):
    —-print hex(x)

    the rest is up to you. i assume for dec you want dec(str(x)) but it is unclear if you want the hex/bin of the dec value, the hex/bin of the ascii value, or just want to stay in dec

    By ChaosGrimm on Oct 15, 2011

Sorry, comments for this entry are closed at this time.