Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- total_price = 0
- item_count = 0
- items = []
- discount = 0
- delivery_fee = 0
- print("If you have short item or want to end in half way then press 0")
- print()
- while item_count < 10:
- print("Enter the price of the item (only positive number is accepted:")
- price = float(input())
- if price == 0:
- break
- elif price < 0:
- print("Not valid ! price should be in positive number only.")
- continue
- print("Enter the name of the item:")
- item_name = input()
- print("Enter the quantity of the item (positive number only):")
- quantity = int(input())
- if quantity <= 0:
- print("Error: Quantity must be positive.")
- continue
- items.append({
- "name": item_name,
- "price": price,
- "quantity": quantity
- })
- total_price += price * quantity
- item_count += 1
- if total_price == 0:
- print("Error: No valid items entered. Please retry.")
- else:
- if total_price > 100:
- discount = total_price * 0.1
- total_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement