Data Science exam 1 part 2

I have a question about question 3 in part 2.

Research has shown that when shoppers see odd prices like $1.99 or $7.95, they assume something is on sale. Our store makes sure all discounted items have odd prices while normal items have even prices.

The sale at our store has ended, and we need to find all of the items that have odd prices so we can remove the discount.

You will need to:

  1. Fix the syntax error in the program.
  2. Use a for loop to loop over the all_items list which contains each item’s name and price.
  3. Find all items with an odd price and add the name of the item to the discounted_items list.

Make sure the testing code which prints discounted_items is at the bottom of your code. Do NOT print out items that are not discounted.

Are we looking to simply remove them from the list or replace them into the discounted_items list as well? if so what is an efficient way of doing both code wise?

The instructions say nothing about removing items, only creating a new list of selected items. It says to use a for loop. Look for a way to follow the instructions and return the expected result and forget about efficiency.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.