In: Computer Science
Python Programming Question
Bicycle shop. A bicycle shop sells bikes and helmets. Some people already own helmets, so on average the shop sells three helmets for every five bicycles. Helmets cost $50 and bikes cost $250. Write a program that prompts for the number of bikes that the shop expects to sell over the next month and outputs the total amount of expected revenue.
You should not be using eval() at all; use int() or float() instead when called for.
def calculateRevenue(): numberOfCycles = input("the number of bikes that the shop expects to sell over the next month? ") costForCycle = 250; costForHelmets = 50; numberOfHelmets = int(numberOfCycles/5)*3; totalCost = (numberOfHelmets*costForHelmets) + (costForCycle*numberOfCycles) print "the total amount of expected revenue", totalCost calculateRevenue()