Question 10: Operators

Jake owns a fruit stand. He sold 30 apples for $2 each, 20 bananas for $1 each, and 15 oranges for $3 each. Write a Python program to calculate the total revenue Jake made from selling fruits.

  • Start by asking for Jake’s name and store it in a variable called name.
  • Define variables for the number of each type of fruit sold and their respective prices:
    • Store the number of apples sold in a variable called num_apples and set it to 30.
    • Store the price of each apple in a variable called apple_price and set it to 2.
    • Store the number of bananas sold in a variable called num_bananas and set it to 20.
    • Store the price of each banana in a variable called banana_price and set it to 1.
    • Store the number of oranges sold in a variable called num_oranges and set it to 15.
    • Store the price of each orange in a variable called orange_price and set it to 3.
  • Calculate the total revenue by multiplying the number of each type of fruit sold by their respective prices.
  • Print a message that includes Jake’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!