+ 2

I face test case problem of hovercraft code coach in Sololearn. Please help me. Here is my code:

insurance=1000000 num_of_hovercraft=10 cost_per_hovercraft=2000000 total_cost=insurance+(num_of_hovercraft*cost_per_hovercraft) sp=3000000 s=int(input("Enter number of sales:")) rev= sp*s if rev > total_cost : print (" profit") elif rev < total_cost : print (" loss") else: print (" broke even")

4th Mar 2023, 6:29 AM
Dipanita Saha
Dipanita Saha - avatar
3 odpowiedzi
+ 6
Be careful with your print statements. If the logic is correct (we need to know what the task is), then you probably don't want to print a space before your words profit, loss and broke even.
4th Mar 2023, 6:49 AM
Ausgrindtube
Ausgrindtube - avatar
+ 6
Check constraints what output u have to print it must be same as which is given in question don't add extra spaces print("Profit") print("Broke Even") print("Loss")
4th Mar 2023, 7:11 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Also don't add any prompt message in input(), just use s = int( input() ) it's already noted : Remove leading space..
4th Mar 2023, 9:03 AM
Jayakrishna 🇮🇳