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:
- The
- Pass the first argument as a
- Iterate the result using a
need an explanation for this answer? contact us directly to get an explanation for this answerzip()function can take two or more lists, aggregate them in a tuple, and returns it.list1and seconds argument as alist2[::-1](reverse list using list slicing)forloop