+ 1

Hovercraft challenge

For the life of me, when I think it is clicking.. I miss one small process. Here is my code for the Hovercraft Challenge.. sales=int(input()) hov=10 cost=2000000 sell=3000000 insu=1000000 if sales==(hov*cost): print("Broke Even") if sales>=((hov*cost)+insu): print("Profit") else: print("Loss") So close and passing case 3&4 but not 1,2 or 5. Please help <3

4th Aug 2022, 9:08 PM
M Heather Fleming
M Heather Fleming - avatar
8 Réponses
+ 3
I think you forgot the insurance in the if statement for "broke even". The second if should be > and not >=.
5th Aug 2022, 4:19 PM
Paul
Paul - avatar
+ 2
You forgot to multiply sales with sell. the first if should look like this: if sales * sell==monthlysales+insu: and all if lines should look the same, except for the compare sign.
8th Aug 2022, 5:19 PM
Paul
Paul - avatar
+ 1
Elif?
5th Aug 2022, 8:40 PM
Michael Tuft
Michael Tuft - avatar
+ 1
Thank you!!
7th Aug 2022, 3:03 PM
M Heather Fleming
M Heather Fleming - avatar
+ 1
# cost 2 Million to build, sells for 3 Million, and I pay 1 Million a month, I build 10 in 1 month # Task- determine whether or not i made a profit based on how many of the ten hovercrafts i was able to sell that month. output('Profit','Loss', 'Broke Even') # total cost to build 10 for the month cost= 2000 * 10 # income from sell sell= 3000 # insurance cost insurance= 1000 #input for number sold sold= int(input()) #X is the variable for the total loss x= cost + insurance #Y is the variable for the total profit y= sell * sold if y > x: print('Profit') elif y < x: print('Loss') elif y == x: print('Broke Even') # NOTE to make it easier to count the zeros i divided each variable by 1000.
20th Sep 2022, 6:51 PM
Maverick Jones
Maverick Jones - avatar
0
My code is still returning “Loss” for the first test (hence failing) and only passing 3&4. This is such a seemingly easy operation but i dont know what im missing sales=int(input()) hov=10 cost=2000000 sell=3000000 insu=1000000 monthlysales=cost*hov if sales==monthlysales+insu: print("Broke Even") if sales>monthlysales+insu: print("Profit") if sales<monthlysales: print("()Loss")
8th Aug 2022, 5:10 PM
M Heather Fleming
M Heather Fleming - avatar
0
sales=int(input()) hov=10 cost=2000000 sell=3000000 insu=1000000 monthlysales=cost*hov if sales==monthlysales+insu: print("Broke Even") if sales>monthlysales+insu: print("Profit") if sales<monthlysales: print("Loss")
8th Aug 2022, 5:13 PM
M Heather Fleming
M Heather Fleming - avatar
0
I think it might be because you have 3 if statements. Try taking out the last 2 “if” and replace them with “elif”. Also for the print loss option you left out to +insu next to monthlysales.
20th Sep 2022, 7:07 PM
Maverick Jones
Maverick Jones - avatar