+ 1
Is it possible to have a input() be able to take a string or integer.
How would I be able to have an input be able to have a string or integer entered without changing the statement type (str/int/etc).
2 Answers
+ 5
input()n will always bring in a string because the function doesn't know what someone might type in. You just have to convert it to whatever you need. This gives you control over error handling / exception handling.
+ 2
You would have to overwrite the function with your own implementation that can return an integer or other misc appropriate data type.
Python's built in function assumes string, always.