TypeError: unsupported operand type(s) for /: 'str' and 'str'
By turning them into integers instead:
percent = (int(pyc) / int(tpy)) * 100;
In python 3, the input()
function returns a string. Always. This is a change from Python 2; the raw_input()
function was renamed to input()
.
The first thing you should do is learn to read error messages. What does it tell you -- that you can't use two strings with the divide operator.
So, ask yourself why they are strings and how do you make them not-strings. They are strings because all input is done via strings. And the way to make then not-strings is to convert them.
One way to convert a string to an integer is to use the int function. For example:
percent = (int(pyc) / int(tpy)) * 100