In this python tuple program, we will create a tuple with 2 lists.
Steps to solve the program
- Take two lists as input.
- Combine elements having the same index no using zip() and convert that list into a tuple using tuple().
- Print the output.
list1 = [4, 6, 8]
list2 = [7, 1, 4]
tup =tuple(zip(list1,list2))
print(tup)
Output :
((4, 7), (6, 1), (8, 4))
find the maximum value from a tuple.
1 thought on “Program to create a tuple with 2 lists of data”