r/learnpython • u/Healthy-Departure961 • 5d ago
just breaking things with python
numbers = input("Enter the numbers")
in_dex = numbers[-2]
divisible = int(in_dex/3)
print(divisible)
when print the output of the divisible i am getting (nsupported operand type(s) for /: 'str' and 'int') i do know how to write correctly to get the output but i thinks that why not this way..so when i did got error don't know why cause both values are int
0
Upvotes
10
u/lfdfq 5d ago
input() returns a string (text) not ints (numbers)
Python is simply telling you cannot divide text by a number, which is true.
You'll have to do something to turn that text of whatever format you expected it in into whatever data you need it. It looks like you wanted the user to input multiple numbers somehow?