r/pythonforengineers • u/Always_Keep_it_real • Feb 18 '21
Help me with a programming code please. I really need your help? 🙏🙏
9
Upvotes
r/pythonforengineers • u/Always_Keep_it_real • Feb 18 '21
2
u/UpscaleVideoBot Feb 18 '21
O1 is each item in the list, iterated by the for loop
1
u/PM_ME_YOUR_STOCKPIX Feb 18 '21
Unrelated to your question but the second for loop appends items to “lista” but then outputs “list” — and then “lista” is never used. I’m guessing this was a typo
1
u/AD_Burn Feb 18 '21
Using sum as function name and also variable name is wrong.
Also python reserved keywords should not be used as variable names,
sum as keyword already exists same as list keyword.
So your example should be:
But back to your question, o1 is value of list_1 item.
Since you iterate with keyword for over elements of list_1, o1 hold value for
current element.
Lets say:
Result would be:
1
u/densch92 Feb 19 '21
o1 is just some dummy variable which is assigned the different elements in list_1 one after another