add, mul operators also support strings

Jan. 23, 2022
3:57 p.m.
https://docs.python.org/3/library/operator.html says "operator.add ... Return a + b, for *a* and *b* numbers " and "operator.mul... Return a * b, for *a* and *b* numbers" but both of those also work on strings [0] (and perhaps other types):
[0] "Strings can be concatenated (glued together) with the + operator, and repeated with *"
3 * 'un' + 'ium''unununium'
https://docs.python.org/3/tutorial/introduction.html#strings
1127
Age (days ago)
1127
Last active (days ago)
0 comments
1 participants
participants (1)
-
Gabriel Sroka