Strange Posted August 3, 2019 Posted August 3, 2019 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? 1
Lizwi Posted August 3, 2019 Author Posted August 3, 2019 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
Strange Posted August 3, 2019 Posted August 3, 2019 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. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now