A store charges $12 per item if you buy less than 10 items. If you buy between 10 and 99items, the cost is $10 per item. If you buy 100 or more items, the cost is $7 per item. Write aprogram that asks the user how many items they are buying and prints the total cost. ans this using python code


num_items = int(input("How many items are you buying? "))

if num_items < 10:
cost_per_item = 12
elif num_items >= 10 and num_items < 100:
cost_per_item = 10
else:
cost_per_item = 7

total_cost = num_items * cost_per_item
print("The total cost is $" + str(total_cost))



This code first prompts the user for the number of items they are buying, then uses an if-elif-else statement to determine the cost per item based on the number of items. It then calculates the total cost by multiplying the number of items by the cost per item and prints the result.

You could name this code "item_cost_calculator" or something similar.

Here is an example of the output of the code I provided:

How many items are you buying? 15
The total cost is $150


This is what the user would see if they entered 15 when prompted for the number of items they are buying. The total cost would be calculated as 15 items * $10/item = $150.

Note that the output will vary depending on the number of items the user inputs. If the user inputs a number less than 10, the cost per item will be $12 and the total cost will be calculated accordingly. If the user inputs a number of 100 or more, the cost per item will be $7 and the total cost will be calculated accordingly.