+ 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.

8th Jun 2022, 12:59 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
12 Answers
+ 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")
8th Jun 2022, 1:26 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
+ 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.
8th Jun 2022, 1:04 PM
Lisa
Lisa - avatar
+ 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.
8th Jun 2022, 1:13 PM
Justice
Justice - avatar
+ 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.
8th Jun 2022, 1:18 PM
Justice
Justice - avatar
+ 1
Make sure that the output strings match exactly the ones in the task description: it is "Broke Even"
8th Jun 2022, 1:20 PM
Lisa
Lisa - avatar
+ 1
No problem. Sometimes you just have to question your own logic with things, which is why Duck-Debugging works well. 👍🏾
8th Jun 2022, 1:27 PM
Justice
Justice - avatar
0
What does "loss" mean in this context?
8th Jun 2022, 1:01 PM
Justice
Justice - avatar
0
'' answer'' not "loss '' typing error
8th Jun 2022, 1:03 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
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")
8th Jun 2022, 1:11 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
0
But have failed to get the required code to answer t
8th Jun 2022, 1:11 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
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
8th Jun 2022, 1:16 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar
0
Let me try what you have adviced me to do thanks
8th Jun 2022, 1:21 PM
Tumwesigye Bashir
Tumwesigye Bashir - avatar