Need pizza count cost from a dual list

I have attached a screen shot of a problem I’m having?

I can’t get the “num_two_dollar_slices = pizzas.count(str(2))” to equal anything but 0.
I’ve tried pizzas.count(2), pizzas.count(‘2’) I’ve even tried moving the count string to different spots in the flow of things.

pizzas = list(zip(prices, toppings))

num_two_dollar_slices = pizzas.count(str(2))

No matter what I put in the parenthesis, I get 0 when I print.
Does anyone have any insight to this?

Hey, @wickdw8yz. You don’t need to count the number of 2's in pizzas. You can just count the 2's in prices. Keep in mind that 2 is an int not a string, so you won’t find any str(2)'s in either list.

1 Like

@midlindner Dang it, why didn’t I think of that. Thanks.

1 Like

Soon you’ll be learning about tuples. It would be a worthwhile learning experience to investigate why your original pizzas.count(2) resulted in 0. Hint: pizzas is a list of tuples.

Ok, thanks. I’ll keep that in mind. I save all of the module challenges to look back on. I’ve seen that tuples word before, but haven’t learned it yet

1 Like