+ 1
Who can loss this question for me?
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.
12 odpowiedzi
+ 2
This is correct code. Thanks for your help
sale = int(input())
if (sale>=8):
print ("Profit")
elif sale==7:
print ("Broke Even")
elif sale<=6:
print ("Loss")
+ 2
Please tag the relevant programming language.
If it is a sololearn task, please mention the course/ task name.
What have you tried? Please link your code attempt, so we can help you to solve it yourself.
+ 2
Can you explain your logic with that first if condition? How can something be greater or equal to 8 AND also be equal to 10? That will almost always return false unless the number is exactly 10.
+ 1
Why not just say if greater than or equal to 8 is a profit? I'm not understanding the need for the two conditions.
+ 1
Make sure that the output strings match exactly the ones in the task description: it is "Broke Even"
+ 1
No problem. Sometimes you just have to question your own logic with things, which is why Duck-Debugging works well. 👍🏾
0
What does "loss" mean in this context?
0
'' answer'' not "loss '' typing error
0
The programming language is python
Yes its a sololearn task, course name is hovercraft
My solution
sale = int(input())
if (sale>=8 and sale==10):
print ("Profit")
elif sale==7:
print ("Even")
elif sale<=6:
print ("Loss")
elifsale<=7:
print ("Broke")
0
But have failed to get the required code to answer t
0
If the sale is equal or greater to 8 "and" the sale is equal to 10
There should be a profit
And i used the and operator for that code statement
0
Let me try what you have adviced me to do thanks