Question 29: If Elif Else Amusement

🎢 Amusement Park Budget Planner

Write a Python program to help a child plan their visit to an amusement park.


📝 Instructions:

  1. Ask for the child’s name and store it in a variable called name.

  2. Ask how much money they brought with them and store it in a variable called money_brought (as an integer).

  3. Tickets to enter the park cost $20, and each ride costs $5.

    • Subtract the ticket cost from their total money:

      remaining_money = money_brought - 20
  4. Ask how many rides they want to go on and store it in a variable called rides (as an integer).

  5. Multiply rides * 5 and store it in a variable called ride_cost.

  6. Subtract the ride_cost from remaining_money to find out what’s left.

  7. Use if-else to check:

    • If ride_cost is less than or equal to remaining_money, print:
      “Great choice, [name]! You can enjoy [rides] rides and will have $[remaining_money – ride_cost] left!”

    • If ride_cost is more than remaining_money, print:
      “Oops, [name]! You need $[ride_cost – remaining_money] more to go on [rides] rides. Try fewer rides!”

Write what you are looking for, and press enter to begin your search!