#8 Python Tutorial for Beginners

Hello Guys,

   In previous tutorial you learned about while loop , list value with while loop , for loop , range function , break statement and continue statement.

   In this tutorial you will learn below points:

  • Function 
  • Types of function
  • Function With Argument
  • Default Parameter Value
  • Recursion
Let's get started.

Function

  • function is group of statement performing specific task.
  • function can be reused by the programmer any number of time.
Syntax :
               def  function_name( ):
                           "block of statement"
  • def "keyword" is used to create function.

Example :



Types Of Function

   

   Built In Function

  • Built in function means already present in python.
  • Example of Built in function includes len( ) , print( ) , range ( ).

   User-Defined Function

  • User Defined function means function create by programmer.


Function With Argument

  • value can be passed into function as argument.
  • Argument are specified in function parentheses. We can add many argument and separated by comma.
Syntax :

        def  function_name( argument_name ):
                           "block of statement"

Example :



    Default Parameter Value

    • we can have a value as default parameter in a  function.
    • If user call the function without parameter value then it uses the default parameter value.
    Syntax :

            def  function_name( argument_name = "argument_value"):
                               "block of statement"

             function_name("argument_value")
             function_name( )

    Example :



    Recursion

    • Recursion is a function which  call itself.
    • Recursion is a common mathematical and programming concept.
    Example :





    I hope you like post. If you liked this post do comment ,share and promote the post 🙏 . Please stay with us and support.  🙏

    Post a Comment

    1 Comments

    1. Hello Guys I have made a new blogging website for tech persons = http://c-tech.lovestoblog.com/
      must visit everyday updates related to tech products and also best point is that there is also buying link of the product. +plus point is that there I also subscribe option where you all can subscribe to us and find daily product updates in gmail

      ReplyDelete