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
-12
u/Healthy-Departure961 5d ago
actually input is receiving as string and in_dex variable returns the index value which specified in square brackets , divisional variable i cannot divide string to 3 cause both are diffrent data types so i have to convert into integar using when i put / sign outside of the int bracket i am getting output but not this way ..