DEV Community

T-Roy
T-Roy

Posted on

rate me as a beginner in python

print("welcome to ishop culculator")

ask the user how many items they have in basket

basket_items = int(input("how many items you have in basket: "))
basket = []
prices = []

adding items to the basket

print("let's get to counting them ...")

for i in range(basket_items):
item = input("enter the name of item number : ".format(i+1))
basket.append(item)
price = float(input("enter price of item: $"))
prices.append(price)

ask for total

opinion = input("do you want to see what items in your basket? (yes/no): ").lower()
if opinion == "yes":
print(basket)
total = input("would you like to see how much it'll cost?")
if total == "yes":
print(f"${sum(prices)}")
else:
print("thank you for shopping with us")

Top comments (0)