比较列表和返回索引

时间:2018-03-18 10:54:47

标签: python python-3.x list compare

List1 = ['3','1','2']
List2 = ['0','1','0']
List3 = ['string1','string2','string3']

我想做

 if List1[i] > 3 and List2[i] = 0 # i = iterating through list1/2 at the same time and comparing them
     print(List3[i]) # i = being the index number found when the if statement is met

#expected output = 'string1'

背景:https://repl.it/@glasgowm1498/GreenyellowKnowingCommands

1 个答案:

答案 0 :(得分:0)

我会在zip函数documentation

中使用python的构建
{{1}}

希望它有所帮助!

相关问题