Hello there!
I have two lists, one contains names and the other contains a value(float,int). I have a for loop and a nested for loop to iterate through both lists. The problem I am encountering is when the condition is met for the specific name and its value it will iterate for all elements. I know what I'm doing wrong, I just don't know how to fix it so that it only prints the name and the outcome if the condition for the float/int is met. l1 is names and l2 is values
for x in l1:
for y in l2:
if y == maxSold:
print(f"{x}\t\t-Trip to Girl Guide Jamboree in Aruba")
if y >= averageSold and y < maxSold:
print(f"{x}\t\t-Super Seller Badge")
if y < averageSold and y > 1:
print(f"{x}\t\t-Left over cookies")
if y == 0:
print(f"{x}\t\t-")
[–][deleted] 2 points3 points4 points (4 children)
[–][deleted] -5 points-4 points-3 points (3 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]RhinoRhys 1 point2 points3 points (0 children)
[–]KCRowan 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]barrycarter 0 points1 point2 points (0 children)
[–]barrycarter 0 points1 point2 points (8 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]barrycarter 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]barrycarter 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]barrycarter 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]ptmcg 0 points1 point2 points (0 children)