I'm kicking off a 15-day Python quiz challenge with a classic question that often trips up developers. Check out this code snippet: `print(3 * '2')`. What do you think the result will be? Does Python handle this as a math operation or is it more about string manipulation? Drop your thoughts in the comments!
2 Answers
Funny enough, I think a lot of people might actually assume it's a math operation, but Python just concatenates the string instead. Always good to brush up on these little details!
Seems like a simple one, but it's a bit tricky! When you multiply a string by an integer in Python, it actually replicates the string. So, `3 * '2'` results in `'222'`. It's a neat little quirk!

Totally agree! It's surprising how many beginners might not know about this behavior.