Alex is preparing for his upcoming vacation. He bought a plane ticket for $250, a suitcase for $60, and sunscreen for $20. Write a Python program to calculate the total money Alex spent.
Store Alex’s name in a variable called name
.
Define variables for the costs of the plane ticket, suitcase, and sunscreen:
ticket_cost
and set it to 250.suitcase_cost
and set it to 60.sunscreen_cost
and set it to 20.Calculate the total amount by adding ticket_cost
, suitcase_cost
, and sunscreen_cost
.
Print Output:
“Hi Alex! You spent a total of $[total_spent] on your vacation shopping.”
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!