Created
March 1, 2018 22:11
-
-
Save enseitankad0/b781796c295b49f40f316c8d1e22f11e to your computer and use it in GitHub Desktop.
Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### FUNCTIONS IN PYTHON ### | |
def returning(a): | |
return "I am a result!",a | |
returnedVal = returning(5) | |
print(returnedVal) ## need to extract from brackets | |
def add(a,b=4,d=10): | |
c = a + b + d | |
return c | |
result1=add(10) | |
print(result1) | |
### SCOPE ### | |
def outer(a): | |
def nested(x): | |
return x*a; | |
a = nested(a) | |
return a | |
print(outer(5)) ##5*5 | |
def f(a): | |
def g(b): | |
return a*b; | |
return g | |
print(f(4)(24)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment