Function

Total Post:113

Points:791
 293  View(s)
Ratings:
Rate this:

How to create function in python ?

  1. Post:140

    Points:984
    Re: Function

    Python Functions :

    A function is a block of code which only runs when it is called. You can pass data,which is known as parameters,into a function. 

    Creating a Function : 

    def my_function(): 
      print("Hello Mindstick")

    Calling a Function: 

    def my_function(): 
      print("Hello Mindstick")
    my_function() 

    Passing parameters :

    def my_function(fname):
      print(fname + " Refsnes")
    my_function("Email")
    my_function("Resume")
    my_function("contacts")
    

    Lambda Functions:

    myfunc = lambda i: i*2
    print(myfunc(2))

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.