+ 2
When i wrote print("x"*x) where x=7 i got output xxxxxx .
why
3 ответов
+ 4
Multiplying a string by a number is usually nonsense in programming languages but python enables it and the result is the string concatenated x times.
The string itself in the above example, "x" does not refer to the variable or the value 7, it could just as well be "ham" and then the result would be hamhamham.... 7 times.