0
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]


for x in adj:
  for y in fruits:
    print(x, y)

I need to get the list as separate dynamically new list 1: ["red", "apple"] new list 2: ["big", "banana"] new list 3: ["tasty", "cherry"]. One problem here is list size will changed (adj,fruits)

mahendra
  • 37
  • 5

1 Answers1

0

Try the following list comprehensions

combined_list_of_lists = [list(l) for l in zip(adj, fruits)]
nandal
  • 2,544
  • 1
  • 18
  • 23
  • It was created in single list. I need separate list dynamically based on input list size like list1 list2 and list 3 – mahendra Jul 22 '20 at 06:26
  • @mahendra, you can access these lists using index as `combined_list_of_lists[0], combined_list_of_lists[1], combined_list_of_lists[2]` and can assign them any name as ` list1 = combined_list_of_lists[0]` and so on – nandal Jul 22 '20 at 06:30