I want to iterate over two lists. The first list contains some browser user-agents and the second list contains versions of those browsers. I want to filter out only those user-agents whose version is greater than 60.
Here is how my list comprehension looks:
[link for ver in version for link in useragents if ver > 60]
The problem with this list is that it prints same user-agent multiple times. I wrote the following using the zip
function, which works fine:
for link, ver in zip(useragents, version):
if ver > 60:
# append to list
print(link)
Why is my list comprehension returning unexpected results?