0

I would like to print here, profitable unprofitable instead of true or false but how

def profitable(d1, d2): area = d1 * d2 invest = area > 700 return invest buy = profitable(90, 120) print(buy)

10th Oct 2023, 6:49 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
11 Respuestas
+ 3
you could use "if/else" and print "profitable" if area>700 (true), else "unprofitable"
10th Oct 2023, 7:15 PM
Aaron Lee
Aaron Lee - avatar
+ 2
Save your attempt (don't worry about it not working or throwing errors) in the code playground and post it here so we can help you figure out what's going wrong
10th Oct 2023, 7:28 PM
Aaron Lee
Aaron Lee - avatar
+ 2
Are you just wanting it to print profitable or unprofitable? You can return the string instead of printing it
10th Oct 2023, 8:13 PM
Aaron Lee
Aaron Lee - avatar
+ 2
Aaron Lee like this? https://code.sololearn.com/cbE2QIIUhOuF/?ref=app Is there any way to close or stop return?
10th Oct 2023, 8:27 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
+ 2
No I meant use "return" instead of "print"
10th Oct 2023, 8:32 PM
Aaron Lee
Aaron Lee - avatar
10th Oct 2023, 8:34 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
+ 2
Aaron Lee thanks for your help 🙂
10th Oct 2023, 8:37 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
+ 2
Eaz Mahodi Sagor you're welcome
10th Oct 2023, 8:49 PM
Aaron Lee
Aaron Lee - avatar
0
Aaron Lee i have tried with if/else but something is going wrong while i tried with if/else, will you please write the code so that i can analyze.
10th Oct 2023, 7:18 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
0
Ok
10th Oct 2023, 7:28 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
0
Aaron Lee I have doen it but one problem How to stop return?? If i disable return it shows none, how to print only profitable or unprofitable? https://code.sololearn.com/cbE2QIIUhOuF/?ref=app
10th Oct 2023, 8:05 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar