- 1

Can someone help me with my python code please?

I am doin the Boat task

2nd Feb 2020, 5:11 AM
Francisco Victor
13 Respuestas
+ 14
Francisco Victor your code need updates like don't required three argument one can sufficient. Then some syntax error due to variable not declare so you can declare those variables like this way. p = 10 def fcvs(sell): cost = (p * 2000000) + 1000000 fee = sell * 3000000 if cost > fee: print("Loss") elif cost == fee: print("Broke Even") else: print("Profit") sell = int(input()) fcvs(sell)
2nd Feb 2020, 5:52 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 10
Francisco Victor first error f is not declared here so what you ate assigning in fcvf = f here is one error Second error is >= and <= then in that while statement operand missing like while $sell => 0 and (here missing)=< 10): That can be an fix while (sell >= 0 and sell =< 10):
2nd Feb 2020, 5:28 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
You can simplify your code a lot if you do the math first. 10 builds/month x $2000 each = $20,000 cost/month, plus $1,000 insurance = $21,000. At $3,000 per sale, your break even number is 21000/3000 = 7 sales/month. Then your code is simply: n = int(input()) if n > 7: print("Profit") else: print("Loss" if n < 7 else "Broke Even")
2nd Feb 2020, 5:46 AM
David Ashton
David Ashton - avatar
+ 4
You should write >= and <= not => and =<
2nd Feb 2020, 5:20 AM
★᭄ꦿ᭄ꦿနίԹʆαနʍմန
★᭄ꦿ᭄ꦿနίԹʆαနʍմန - avatar
+ 4
also sell is not defined
2nd Feb 2020, 5:31 AM
BroFar
BroFar - avatar
+ 4
Edit =< to <= sell <= 10
2nd Feb 2020, 5:42 AM
★᭄ꦿ᭄ꦿနίԹʆαနʍմန
★᭄ꦿ᭄ꦿနίԹʆαနʍմန - avatar
+ 3
yes you can help us by showing us your attempt so we can help you better....
2nd Feb 2020, 5:13 AM
BroFar
BroFar - avatar
+ 2
Sorry def fcvf(cost, fee, sell): cost + fee - sell*3000000 cost = 2000000 fee = 1000000 fcvf = f if f < 0 : print('Profit') else: print(Loss) while sell => 0 and =< 10: print(i = i + 1) print (f)
2nd Feb 2020, 5:13 AM
Francisco Victor
+ 2
Ok
2nd Feb 2020, 5:38 AM
Francisco Victor
+ 1
It is saying the = is an invalid syntax, i dont get it
2nd Feb 2020, 5:15 AM
Francisco Victor
+ 1
Can someone help me?
2nd Feb 2020, 5:17 AM
Francisco Victor
+ 1
Thanks
2nd Feb 2020, 5:38 AM
Francisco Victor
+ 1
def fcvf(cost, fee, sell): cost + fee - sell*3000000 cost = 2000000 fee = 1000000 fcvf = f if f < 0 : print('Profit') else: print(Loss) while sell >= 0 and sell =< 10: print(i = i + 1) print (f) Like this?
2nd Feb 2020, 5:40 AM
Francisco Victor