Python Development: Defining, Configuring, & Invoking Functions

Python    |    Beginner
  • 13 videos | 1h 44m 23s
  • Includes Assessment
  • Earns a Badge
Rating 4.5 of 117 users Rating 4.5 of 117 users (117)
In Python, functions are essentially first-class citizens. They are objects in Python, just like other primitive and complex data types, and have a valuable purpose. In this course, you'll learn how to define and invoke functions in Python. First, you'll define a function using the def keyword and specify input arguments and return values from functions. You'll then work with positional arguments and keyword arguments. Next, you'll define functions with default values for arguments and a variable number of arguments. Along the way, you'll also examine how arguments can be pass-by-value or pass-by-reference. Finally, you'll explore the characteristics of Python functions that make them first-class citizens. When you're finished with this course, you'll have a solid grasp of the foundations of support for functions in Python and be able to use Python functions in your development work.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Define and invoke functions
    Pass values to functions via input arguments
    Use the return keyword to return values from functions
    Use the positional, keyword, and default arguments
    Pass a variable number of positional arguments to a function
    Pass a variable number of keyword arguments to a function
  • Execute python scripts from the command line
    Use local and global arguments
    Pass arguments to functions by value and reference
    Illustrate the characteristics of first-class functions
    Store functions in variables and lists
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 14s
    In this video, you’ll learn more about the course and the instructor. In this course, you’ll learn how to define and invoke functions in Python. You’ll learn how to define a function using the def keyword and specify input arguments and return values from functions. You’ll discover how position and keyword arguments work and see how default argument values can be specified. Next, you'll learn how functions can be defined to accept arguments. FREE ACCESS
  • 9m 45s
    In this video, you’ll watch a demo. In this demo, you’ll focus on Functions. You’ll learn the most important difference between Python and Java is the importance of Functions in Python. You’ll discover Java is an object-oriented programming language, while in Python, Functions are the basis of your programming. You’ll discover Functions can be thought of as a set of operations that accept inputs, perform some kind of computation and then produce output. FREE ACCESS
  • Locked
    3.  Passing Python Values Using Input Arguments
    9m 2s
    In this video, you’ll watch a demo. In this demo, you’ll learn other aspects of Python Functions. You’ll follow along, using the function_with_error. You’ll learn this is the function definition, the function wasn’t invoked. You’ll find the reason this is named function_with_error is that it contains an error. In the demo, you’ll see a string with a number using the plus operator which won’t work. Since you haven’t invoked the function, no error was flagged. FREE ACCESS
  • Locked
    4.  Returning Python Values Using the Return Keyword
    11m 39s
    In this video, you’ll watch a demo. You’ll learn about return values from a function. You’ll learn it’s ideal for code to consist of functions that operate on individual items in a data matrix and have no side effects. You’ll see another simple function onscreen, which takes the input argument x multiplies x by itself and saves this value in another variable y. You’ll then print out the value of y, but won’t return it. FREE ACCESS
  • Locked
    5.  Using Positional, Keyword, and Default Arguments
    12m 18s
    In this video, you’ll watch a demo. You’ll deal with Positional Arguments, Keyword Arguments, and Default values for Arguments. You’ll learn that Positional and Keyword Arguments refer to the manner in which a function is invoked. Default values for Arguments refer to the manner in which function parameters are defined. You’ll find the terms Positional and Keyword Arguments refer to function invocation. Default Argument values refer to function definition. FREE ACCESS
  • Locked
    6.  Working with Python's Positional Variable Arguments
    11m 43s
    In this video, you’ll watch a demo. You’ll learn the arity of a function or an operator is the number of input arguments accepted by that function or operator. You’ll discover how Varargs work in Python. First, you’ll begin by checking the print function. Following along onscreen, you’ll see you can invoke the print function with no input arguments and the result is empty string. You’ll try again with one input argument, the string Python. FREE ACCESS
  • Locked
    7.  Working with Python's Named Variable Arguments
    9m 48s
    In this video, you’ll watch a demo. You’ll learn to define a variable number of keyword-only arguments. This requires the introduction of another Python construct, which you will see onscreen. This is the **kwargs construct. You’ll define a function called add_employee_details. It has one input argument called kwargs, K-W args, and this input argument is preceded by two asterisks symbols. These two-star symbols are a form of the kwargs construct, where KW stands for keyword. FREE ACCESS
  • Locked
    8.  Running Python Files
    6m 30s
    In this video, you’ll watch a demo. You’ll switch away from Jupyter notebooks. You’ll see a .py file onscreen. It’s in the Sublime text editor. On the right, you’ll see a terminal window, which can be used to run Python and execute the file you see on the left. You’ll see on line 1 an invocation of the function print_details_of_order. The function is defined below. Next, you’ll see the def command and run the code. FREE ACCESS
  • Locked
    9.  Using Local and Global Arguments in Python
    6m 46s
    In this video, you’ll watch a demo. You’ll pick up where you left off with the last demo. The code for that demo as well as the output are onscreen. You’ll learn that if you have variables in the local scope that have the same name as variables in the global scope, the local variables will hide the global variables. You’ll see whether those local variables were defined inside the function or not. FREE ACCESS
  • Locked
    10.  Passing Python Arguments by Value and Reference
    7m 42s
    In this video, you’ll watch a demo. This demo is about the semantics of argument passing in Python. You’ll learn Passing by Value and Passing by Reference. Onscreen you’ll see a function called print_student_details which takes in four input arguments, name, age, gpa, and enrolled status, and it then prints them out. Next, you’ll define four global variables, all in the global scope. Later, you’ll redefine your four variables. FREE ACCESS
  • Locked
    11.  Demonstrating First-class Function Characteristics
    8m 29s
    In this video, you’ll watch a demo. You’ll learn Python supports first-class functions. This means Python functions can be assigned to variables. Functions can be passed in as input values to other functions. You’ll also discover functions can be returned values from other functions, and functions can be values in dictionaries or elements in lists. You’ll try out each of these four propositions which together prove Python supports first-class functions. FREE ACCESS
  • Locked
    12.  Storing Python Functions in Variables and Lists
    5m 5s
    In this video, you’ll watch a demo. You’ll pick up where you left off at the end of the last demo. Here, you’ll learn about the third property of first-class functions, which is that one function can return another function as its return value. Onscreen you’ll see a series of functions that return various powers of a number. You’ll see the square, cube, square_root, and cube_root functions. You’ll learn each takes in one input parameter. FREE ACCESS
  • Locked
    13.  Course Summary
    3m 22s
    In this video, you’ll summarize what you’ve learned in the course. You learned about defining, configuring, and invoking functions. You learned about user-defined functions, creating basic functions, and how to invoke them. You also learned functions are objects of a class. You learned to store a function in a variable and to invoke functions by invoking variables as if they were functions. You also learned about input parameters, input arguments, and default arguments. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 5.0 of 1 users Rating 5.0 of 1 users (1)
Rating 4.8 of 10 users Rating 4.8 of 10 users (10)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.6 of 2165 users Rating 4.6 of 2165 users (2165)
Rating 4.6 of 801 users Rating 4.6 of 801 users (801)
Rating 4.6 of 1449 users Rating 4.6 of 1449 users (1449)