user2918356 user2918356 - 1 year ago 139
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 Source

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")


for python 2.x

inputFromUser = raw_input("blah blah blah")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download