Skip to content

Question 8

Evaluate:

('x' * 4 + 'y' * 3) * 2
Solution

Given a positive integer n and string assigned to variable str, str * n means repeating the value of str n times.

('x' * 4 + 'y' * 3) * 2
= ('xxxx' + 'yyy') * 2
= 'xxxxyyy' * 2
= 'xxxxyyyxxxxyyy'
Answer
'xxxxyyyxxxxyyy'