Iterate through 2 lists at once in Python

后端 未结 1 774
南旧
南旧 2021-01-25 06:50

I want to share/divide a specific amount to the members of two Python lists. The members of list1 will have double share each, while the members of list2 will have single share

1条回答
  •  离开以前
    2021-01-25 07:39

    You should use zip() built-in function.

    for i, j in zip(list1, list2):
        print(i, (reminder/9)*2)
        print(j, (reminder/9)*1)
    

    0 讨论(0)
提交回复
热议问题