Given a two Python list. Write a python program to iterate both lists simultaneously and display items from list1 in original order and items from list2 in reverse order.
Given a two Python list. Write a program to iterate both lists simultaneously and display items from list1 in original order and items from list2 in reverse order.
Hint:
Use the
zip()
function. This function takes two or more iterables (like list, dict, string), aggregates them in a tuple, and returns it.Solution:
zip()
function can take two or more lists, aggregate them in a tuple, and returns it.list1
and seconds argument as alist2[::-1]
(reverse list using list slicing)for
loop