+ 1

[Python] Doing hovercraft challenge, it says “no output”

Hi there! So I’m trying to solve the hovercraft challenge: “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.” I wrote this code: def prog(buyers): expenses = 21000000 profits = buyers * 3000000 if profits > expenses: return 'Profit' if profits < expenses: return 'Loss' else: return 'Broke even' But at the result it says “no output”. Any idea why?

8th Apr 2020, 6:56 PM
Eugene
6 Respostas
+ 6
add this at the end of your code-- print(prog(int(input()))) this is 'calling' function. No function will work unless you call them.
8th Apr 2020, 7:04 PM
M Tamim
M Tamim - avatar
8th Apr 2020, 7:04 PM
Oma Falk
Oma Falk - avatar
+ 5
Oma Falk useful comedies😂😂
8th Apr 2020, 7:12 PM
M Tamim
M Tamim - avatar
+ 4
Thanks everyone! Got spoiled by certain online resources that call my functuon automatically by themselves😁
8th Apr 2020, 7:28 PM
Eugene
+ 3
Muntasir R Tamim and so true... There are certain bugs you must have gone through at least once😕😕
8th Apr 2020, 7:19 PM
Oma Falk
Oma Falk - avatar
+ 1
Check out my solution and let me know if it works. https://code.sololearn.com/cvoiK5auyci2/?ref=app
24th Apr 2020, 2:17 PM
JoĂŁo ClĂĄudio Macosso
JoĂŁo ClĂĄudio Macosso - avatar