Why the below answer is incorrect?

This is why:

$ python3
Python 3.13.1 (main, Dec  3 2024, 17:59:52) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = input('enter number')
enter number5
>>> type(x)
<class 'str'>
>>>

input returns a str, and operator ‘*’ on string creates multiple copies of the string!

1 Like