'How to build a function that finds all integers between two values from two different lists using python?

a=[1,2,3]
b=[4,5,6]
output1=list(range(1,4))
output2=list(range(2,5))
output3=list(range(3,6))

How to build a function that takes first value from a list and the first value from another list and finds all possible numbers between the two and repeat it till end of values and saves the output of every range as a different variable using python?



Solution 1:[1]

Does this help you ?

a=[1,2,3]
b=[4,5,6]
result=[ range(min(num1,num2), max(num1,num2)) for num1, num2 in zip(a,b)]

for element in result:
    print(*element)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1