0
What is a str means in pyhton like print(str(i)x i) means
3 Antworten
+ 5
str(i) transforms the i variable to string type.
You can multiply a string by a whole number then the string is repeated as many times as the number.
But multiplication symbol is * and not x
print(str(i) * i)
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2427/
+ 2
str(i) converts i into string.
(Please be strict with syntax rules, x is not same than *, but I assume you're using *)
Multiplying a string with integer i would cause the string to be added to *itself* i - 1 times.
"5" * 5 = "5" + "5" + "5" + "5" + "5" ="55555".
+ 2
These 3 lessons should include all you need to understand the given sample:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2427/
https://www.sololearn.com/learn/Python/2492/
https://www.sololearn.com/learn/Python/2428/