Lens Pizza Slice

Hi Everyone,

I am working on the len’s pizza slice project and am stuck on part 6

" Convert our toppings and prices lists into a two-dimensional list called pizza_and_prices that has the following associated values. “Each sublist in pizza_and_prices should have one pizza topping and an associated price”

Is there a way to make a 2d list with two seperate 1d lists? pizza_and_prices = [prices, toppings] is not properly indexed.
Should I manually create this 2d list?

Hi @mohejazi,

If you wanted to combine two lists like that, you could use the zip method:
https://www.w3schools.com/python/ref_func_zip.asp

Then cast the resulting tuple to a list :slight_smile:

image

-Lyall

That’s what big brother stack overflow had posted as well. This section of the course hasn’t talked about zip or tuples yet, so I’m goonna assume they wanted it manually done. Thank you!

1 Like

Yep, manually. It used to use the .zip() method in prior iterations…
until .zip() was introduced later on in the course.