How it is true please explain it

please explain below program

s = ‘foo’
t = ‘bar’
print(‘barf’ in 2 * (s + t))

so, s and t add to give “foobar”. and on multiplying by 2, it becomes “foobarfoobar”. and you can find “barf” in foobarfoobar. so, the output of “barf” in 2* (s+t) is True.


thanks for the explanation

1 Like