+ 3

Hovercraft syntax error

Hello, all! I made code as below but it states there is syntax error. What item makes it happen? craft=int(input()) profit=3000000*craft-21000000 if profit>0: print("Profit") elif profit=0: print("Broke Even") else: print("Loss")

27th Mar 2022, 10:47 PM
Earl
Earl - avatar
6 Antworten
+ 2
elif profit==0:
27th Mar 2022, 10:49 PM
SoloProg
SoloProg - avatar
+ 2
You are welcome
27th Mar 2022, 10:53 PM
SoloProg
SoloProg - avatar
+ 2
Earl Additional knowledge: Single equal (=) is used to assign value so if you check (profit = 0) it would always return true. Double equal (==) is used to compare two values. So (profit == 0) will either return true or false depends on profit.
28th Mar 2022, 12:56 AM
A͢J
A͢J - avatar
+ 1
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'.
27th Mar 2022, 10:48 PM
Earl
Earl - avatar
+ 1
Oh my.... SoloProg thank you! 🤣
27th Mar 2022, 10:51 PM
Earl
Earl - avatar
+ 1
Thank you! Always appreciated the shared knowledge!
28th Mar 2022, 2:50 AM
Earl
Earl - avatar