[Solved] TypeError: unsupported operand type(s) for /: ‘str‘ and ‘int‘

Contents of articles

Solution of error recurrence Report

Error recurrence

# python code
print('1 divided by 2 equals %f' %1/2)

report errors

TypeError: unsupported operand type(s) for /: 'str' and 'int'

 

Solution:

Just add brackets

>>> print('1Divided by 2 equals %f' %(1/2))
1 divided by 2 equals 0.500000


Read More: