Help me. Python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help me. Python.

This code works BUT....BUT every time the output is “profit”. Even when it has to be “loss”. I don’t know why. https://code.sololearn.com/cC1j8cPY8VmY/?ref=app Thank you very much for your help.

1st Sep 2020, 11:18 AM
Neo
3 Answers
+ 3
compare the number as int. not str also you need print inside else
1st Sep 2020, 11:21 AM
Rei
Rei - avatar
+ 3
n = 2100000 num = int(input()) total = num*300000 if total>n: print("Profit") elif total<n: print("Loss") else: print("Broke Even")
1st Sep 2020, 11:26 AM
Akash Agrawal
Akash Agrawal - avatar
1st Sep 2020, 11:26 AM
Namit Jain
Namit Jain - avatar