+ 4

# Help solve the problem

How to solve the problem? Here is the task: You run a hovercraft factory. Your factory makes ten hovercrafts in a month. Given the number of customers you got that month, did you make a profit? It costs you 2,000,000 to build a hovercraft, and you are selling them for 3,000,000. You also pay 1,000,000 each month for insurance. Task: Determine whether or not you made a profit based on how many of the ten hovercrafts you were able to sell that month. Input Format: An integer that represents the sales that you made that month. Output Format: A string that says 'Profit', 'Loss', or 'Broke Even'. Sample Input: 5 Sample Output: Loss Entering 10 displays an error. Please indicate the error in the code. sales = int(input()) balance = int(sales*1000000-1000000) if balance > 0: print('Profit') elif balance == 0: print('Broke Even') else: print('Loss')

14th Feb 2020, 1:49 PM
+ 2
Ah, I thought insurance didn’t apply to ships. Thanks you
14th Feb 2020, 5:36 PM
+ 1
Sorry if I wrong said about problem
14th Feb 2020, 1:54 PM
+ 1
Vlad The code is wrong. If I sold 2 hovercrafts in the month: Earn: 6M: Selling 2 hovercrafts (2*3M=6M) Loss: 28M: Creating 10 hovercrafts (10*2M=20M) Insurance of 8 hovercrafts (8*M=8M) 6M - 28M = -22M (loss) In your code it would be: sales = 2 balance = sales * M - M = 2M - M = +M (profit)
14th Feb 2020, 5:34 PM
Seb TheS
+ 1
Hare is solution of your problem order= int(input()) sales=order*3000000 cost=20000000 balance = int(sales-21000000) if balance > 0: print('Profit') elif balance == 0: print('Broke Even') else: print('Loss')
12th May 2020, 6:18 AM
Kartik Singh
+ 1
yo Vlad this is the code I wrote with explanations you can run it and see, it works but just go through why it works, dont want to just solve it for you without helping #just assigning a variable to 21 million, this is the amount spent on making 10 hovercrafts in a month #this is usefull in later calculations per_month_payments = 21000000 #getting input of how many hovercrafts were sold hovercrafts_sold_month = int(input("How many hovercrafts were sold? ")) print(hovercrafts_sold_month) #getting the amount of money I- the company made cash_made_from_HCs = hovercrafts_sold_month * 3000000 #cashiness is used in calculating if I- we the company made a profit a loss or if it was Broke e- Even cashiness = cash_made_from_HCs - per_month_payments if hovercrafts_sold_month <= 10: if cashiness > 0: print("Profit") elif cashiness == 0: print("Broke Even") elif cashiness < 0: print("Loss") else: print("how would I- The company sell more hovercrafts then I made??? Sorry didn't mean I made, I meant WE made")
30th Oct 2020, 4:52 PM
Doggo
+ 1
#FROM PYTHON sale=int(input()) Cp=2*10+1 Sp=3*sale if Cp>Sp: print("Loss") if Cp<Sp: print("Profit") if Cp==Sp: print("Broke Even")
14th Jan 2022, 8:01 AM
The Dr.
+ 1
#python kater = int(input()) #кількість проданих катерів min = 21000000 """min - це загальна кількість вират: на виготовлення (10*2млн) і страховку (1млн)""" katers = kater*3000000 """прибуток з продажу""" profit = katers - min #обчислення загального прибутку if profit == 0: print ("Broke Even") #якщо витрати=прибутку elif profit > 0: print ("Profit") #якщо прибуток>витрат else: print ("Loss") #якщо прибуток<вират
10th Mar 2022, 4:47 PM
Богдан Гнатюк
+ 1
n = int(input()) if n > 7: print("Profit") elif n < 7 : print("Loss") else : print("Broke Even")
31st Jul 2022, 5:11 PM
Максут Кудайбергенов
0
Seems to be a logic error.
14th Feb 2020, 4:40 PM
Seb TheS
0
i translated incorrectly. In test with in input 7 programm output profit. But this is a wrong answer. Is it a mistake in the task or mine in code? Code work good.
14th Feb 2020, 5:16 PM