Jump to content

Python functionn

Featured Replies

Works for me:

Python 3.7.3 (default, Mar 30 2019, 03:37:43) 
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def fun(x,y):
...   return x+y
... 
>>> fun(1,2)
3
>>> 

Do you get any kind of error message?

  • Author

I doesn't print anything, and there is no error message until I added "print(fun(1,2))" I did not write it on Shell

12 minutes ago, Lizwi said:

I doesn't print anything, and there is no error message until I added "print(fun(1,2))" I did not write it on Shell

Ah, OK. That is because the program itself didn't generate any output until you added the print. It would be up to the environment (eg shell) to print the result of the function.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.