Last active
January 17, 2019 08:23
Python user defined function
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
#Python user defined function - Syntax | |
""" | |
def function_name(parameters): | |
'''doc string ''' | |
[Block statements] | |
[return statement] | |
""" | |
#Example | |
x, y = 10, 30 | |
#Python user defined function | |
def summation(x, y): | |
''' Summation of two numbers | |
example: c = a + b ''' | |
z = x + y | |
return z | |
#Function call | |
print("Sum of two numbers = ", summation(x, y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment