+ 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
8 Answers
+ 3
I think you forgot the insurance in the if statement for "broke even".
The second if should be > and not >=.
+ 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.
+ 1
Elif?
+ 1
Thank you!!
+ 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.
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")
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")
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.