Jump to content

Python functionn


Lizwi

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

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.