0
A stupid challenge here!Multiply all elements in a list using pop method only.
Like this:a=[1,2,3] p1=a.pop() p2=a.pop().....pop every single one in a listïŒand multiply all of them,do we have to list all the p1,p2,....p(len(a)) viarables?
2 Answers
+ 2
"while list:" will return False when a list is empty. Pop() removes elements so we can loop through the list instead of assigning a variable to each list element. Take a look at my example:
https://code.sololearn.com/cHxAbSj4Np1j/?ref=app
0
Stupid challenge ask for stupid answers. One liner of course. https://code.sololearn.com/cR0xv1XMonf6/?ref=app