Question 21: If Elif Else

Write a Python program to check the type of discount a customer gets based on their total spending.

  1. Start by asking for the customer’s name and store it in a variable called name.
  2. Ask how much they spent (as a float) and store it in a variable called spending.
  3. Use an if-elif-else structure to determine their discount:
    • If spending is greater than or equal to 100, print:
      "Congratulations, [name]! You spent $[spending], so you get a 20% discount!"
    • If spending is greater than or equal to 50, print:
      "Well done, [name]! You spent $[spending], so you get a 10% discount!"
    • If spending is less than 50, print:
      "Thank you, [name]! You spent $[spending], but you need to spend at least $50 for a discount."
Write what you are looking for, and press enter to begin your search!