0

I have something like this right now but this wont work because chr requires an integer. How can I make it print the chr of the user input?

num1 = input("Enter a ASCII code 0 - 127:")
print(str(chr(num1)))

1 Answers1

0

Just cast the user input to int first -

num1 = input("Enter a ASCII code 0 - 127:")
print chr(int(num1))

(Incorporated @chepner's comment)

Vikas Ojha
  • 6,742
  • 6
  • 22
  • 35