+ 1
I need to assign each brand to its corresponding price using for loop
brands=['Motorolla' , 'Nokia' , 'Huawei', 'iPhone'] prices=[1200 ,2000 ,3000 ,25000] I need the output to be: brand: price
3 Answers
+ 1
together = zip(brands, prices)
This will return an iterable.
you can call list(together) to make it a list, or you can leave it as an iterable and use a for loop to iter over it.
+ 1
you can use data type dictionary