+ 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

14th Sep 2017, 12:38 PM
Mohammed Abdulhady
Mohammed Abdulhady - avatar
3 odpowiedzi
14th Sep 2017, 3:15 PM
Testing003
+ 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.
14th Sep 2017, 12:41 PM
chessmonster
chessmonster - avatar
+ 1
you can use data type dictionary
14th Sep 2017, 12:58 PM
mohsen