I’m having problems solving this. I tried multiple times with not success. Please explain how to put together a for loop.
if list a = [element1, element2, element3]
A for loop creates a variable:
for b in a:
The program furnishes each value from list a in turn, ascribing it to the variable b.
After the colon, a certain action is typically suggested.
For example–
for b in a:
c = c * b
(In this case, a third variable would be multiplied by the variable b value).
1 Like