New course! Every coder should learn Generative AI!
Try a free lesson+ 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?
6 Answers
+ 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.
+ 5
https://www.sololearn.com/post/277004/?ref=app
you understand?
+ 5
Oma Falk
useful comedies😂😂
+ 4
Thanks everyone! Got spoiled by certain online resources that call my functuon automatically by themselves😁
+ 3
Muntasir R Tamim and so true...
There are certain bugs you must have gone through at least once😕😕
+ 1
Check out my solution and let me know if it works.
https://code.sololearn.com/cvoiK5auyci2/?ref=app