Learning Scientific Programming with Python (2nd edition)
E2.8: String concatenation with + and *
Strings concatenated with the '+
' operator can repeated with '*
', but only if enclosed in parentheses:
>>> ('a'*4 + 'B')*3
'aaaaBaaaaBaaaaB'
Learning Scientific Programming with Python (2nd edition)
Strings concatenated with the '+
' operator can repeated with '*
', but only if enclosed in parentheses:
>>> ('a'*4 + 'B')*3
'aaaaBaaaaBaaaaB'