+ 2

Why there is no error produced when a string is multiplied by zero?

23rd Mar 2019, 1:09 PM
balaganesh
balaganesh - avatar
2 Answers
+ 15
balaganesh In python, when you multiple any string with any int value, then it multiples the string that many times Like, "Hello" * 3 This will return "HelloHelloHello" Similarly, if you multiply any string by 0, it will return an empty string.
23rd Mar 2019, 1:26 PM
Letsintegreat
Letsintegreat - avatar
23rd Mar 2019, 1:23 PM
balaganesh
balaganesh - avatar