Question 8: Operators

Ethan owns a toy store. He sold 15 toy cars for $5 each, 10 teddy bears for $8 each, and 5 dolls for $10 each. Write a Python program to calculate the total revenue Ethan made from selling toys.

  • Start by asking for Ethan’s name and store it in a variable called name.
  • Define variables for the number of each type of toy sold and their respective prices:
    • Store the number of toy cars sold in a variable called num_cars and set it to 15.
    • Store the price of each toy car in a variable called car_price and set it to 5.
    • Store the number of teddy bears sold in a variable called num_bears and set it to 10.
    • Store the price of each teddy bear in a variable called bear_price and set it to 8.
    • Store the number of dolls sold in a variable called num_dolls and set it to 5.
    • Store the price of each doll in a variable called doll_price and set it to 10.
  • Calculate the total revenue by multiplying the number of each type of toy sold by their respective prices.
  • Print a message that includes Ethan’s name and the total revenue he made in a friendly sentence.
Write what you are looking for, and press enter to begin your search!