Q11: A travel company wants to fly a plane to the Bahamas. Flying the plane costs 5000 dollars. So far, 29 people have signed up for the trip. If the company charges 200 dollars per ticket, what is the profit made by the company?
Fill in values or arithmetic expressions for the variables below.
cost_of_flying_plane = ??? number_of_passengers = ??? price_of_ticket = ???
profit = ???
print('The company makes of a profit of {} dollars'.format(profit))
Q11b Out of the 29 people who took the flight, only 12 buy tickets to return
from the Bahamas on the same plane. If the flying the plane back also costs 5000 dollars, and does the company make an overall profit or loss? The company charges the same fee of 200 dollars per ticket for the return flight. (Optional)
Use an if statement to display the result.
Answer to the question
print('Fill in values or arithmetic expressions for the variables below.')
cost_of_flying_plane = (int(input('Cost of flying plane:')))
number_of_passengers = (int(input('Number of passengers:')))
price_of_ticket = (int(input('Price of ticket:')))
profit=price_of_ticket*number_of_passengers-cost_of_flying_plane
if profit>0:
print('The company makes of a profit of {} dollars'.format(str(profit)))
else:
if profit==0:
print('The company is not making a profit')
else:
print('The company receives a loss of {} dollars'.format(str(profit)))
number_of_passengers = (int(input('Number of passengers who bought a ticket back:')))
profit=profit+price_of_ticket*number_of_passengers-cost_of_flying_plane
if profit>0:
print('The company makes of a profit of {} dollars'.format(str(profit)))
else:
if profit==0:
print('The company is not making a profit')
else:
print('The company receives a loss of {} dollars'.format(str(profit)))
Comments
Leave a comment