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
pizzas. You can just count the
prices. Keep in mind that
2 is an int not a string, so you won’t find any
str(2)'s in either list.
@midlindner Dang it, why didn’t I think of that. Thanks.
Soon you’ll be learning about tuples. It would be a worthwhile learning experience to investigate why your original
pizzas.count(2) resulted in
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