0

Def val_lst?

What is the output of this code? def val_lst(): return [x + y for x in 'spam' for y in 'SPAM'] print(len(val_lst())) Output: 16 spam + SPAM is 8? Where does it say to multiply? Thanks for any help.

2nd May 2019, 11:35 PM
tristach605
tristach605 - avatar
2 odpowiedzi
+ 1
Here one cycle of 4 characters is nested in another cycle of 4 characters: "4+4+4+4". val_lst()=[ sS, sP, sA, sM, pS, pP, pA, pM, aS, aP, aA, aM, mS, mP, mA, mM]
3rd May 2019, 12:34 AM
Solo
Solo - avatar
0
I see. Thanks Vas:).
4th May 2019, 10:52 PM
tristach605
tristach605 - avatar