user2918356 user2918356 - 6 months ago 26
Python Question

Python int and input

I was wondering how you could make it so that input accepts numbers and letters.

I tried

int(input("blah blah blah")


but that doesn't work for letters and it accepts only numbers.

Answer

When you put everything within an int() it forces whatever the input is to be an integer. That is why you don't seem to getting any letters. Try removing the int()

for python 3.x

inputFromUser = input("blah blah blah")

or

for python 2.x

inputFromUser = raw_input("blah blah blah")