I don't know how to multiply in Python.
If I do this:
price = 1 * 9
It will appear like this:
111111111
And the answer needs to be 9 (1x9=9)
9
1x9=9
How can I make it multiply correctly?
Only when you multiply integer with a string, you will get repetitive string..
You can use int() factory method to create integer out of string form of integer..
int()
>>> int('1') * int('9') 9 >>> >>> '1' * 9 '111111111' >>> >>> 1 * 9 9 >>> >>> 1 * '9' '9'
2.1m questions
2.1m answers
60 comments
57.0k users