0

Writing a function in Sololearn codeplayground.

Hi All, I am writing a simple code in Python3. I tried to wite a simple function in Sololearn codeplayground (in browser) as follows: def add(a,b): return a+b add(2,3) ...and the codeplayground displayed a message: No output How is this possible? Don't functions work in codeplayground? Is there anything wrong with my way of writing? I need your comments.

1st Oct 2018, 1:07 AM
Sdesigner
3 Antworten
+ 3
There was no output because there was no call to print function, function add only returns the summation result, so you need to do: print(add(2,3)) And you'll have it on the screen.
1st Oct 2018, 1:26 AM
Ipang
+ 1
Thanks. It worked. By the way is the codeplayground different from IDLE?
1st Oct 2018, 1:41 AM
Sdesigner
+ 1
Sorry, I don't have IDLE currently cause I'm on mobile only, so I can't tell you about that : )
1st Oct 2018, 1:45 AM
Ipang