The Hovercraft test | Sololearn: Learn to code for FREE!

+2

The Hovercraft test

Hallo I have made the Hovercraft test (python) and I have written this code. cost_hover = int(2000000) sell_price_hover = int(3000000) insurance_cost = int(1000000) sales = int(input("how much did you sell?")) cost_made = cost_hover * 10 + insurance_cost revenue = sales * sell_price_hover x = "Profit" y = "Loss" z = "Broke Even" if revenue > cost_made: print(x) if revenue == cost_made: print(z) if revenue < cost_made: print(y) And it says its wrong Some one please help 🤔 Problem solved see answer

3/5/2020 9:43:58 AM

Frankly Quite

10 Answers

New Answer

+2

Is there any errors? While taking input, don't put any message, just only take input.. sales=int(input(""))

+6

isn't the description flawed? --- [ description from challenge] --- Hovercraft 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 Explanation: If you only sold 5 hovercrafts, you spent 21,000,000 to operate but only made 15,000,000. --- [ end description] --- Shouldn't the explanation read: If you only sold 5 hovercrafts, you spent *** 11,000,000 *** to operate but only made 15,000,000. Something does not calculate? With the assumptions made in the description a Profit will always be made if you sell more than 1, and it will 'Break Even' with one sale. There will never be an instance of 'Loss' without a negative sales number?!

+2

replace the missing variable 'reven' with 'revenue' in the last if condition

+1

I have replaced it but still. https://www.sololearn.com/coach/42?ref=app

+1

I made the same mistake first. But your factory makes every Mont 10 hoovers if you sell it or not. So every month your cost will be cost = 10 * price_hover + insurance_cost And that sums up to 21.000.000

+1

yep. I reread it. got thru it. your explanation should help others though. ;)

+1

Check out my solution and let me know if it works. https://code.sololearn.com/cvoiK5auyci2/?ref=app

0

Thank you it worked I got + 10xp

0

Hey guys see my answers to hovercraft and other quizzes I have solved a lot of them and I am still solving they will help you. Check on my id

0

total_sales = int(input()) cost_of_one_hovercraft = 2000000 cost_of_monthly_insurance = 1000000 total_no_of_hovercraft = 10 selling_price_of_one_hovercraft = 3000000 monthly_cost = (cost_of_one_hovercraft * total_no_of_hovercraft) + cost_of_monthly_insurance current_monthly_sales = (selling_price_of_one_hovercraft * total_sales ) if monthly_cost == current_monthly_sales : print('Broke Even') elif monthly_cost > current_monthly_sales : print('Loss') else: print('Profit')