Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Defining and Calling Python Functions (Summary)

As applications grow larger, it becomes increasingly important to modularize code by breaking it up into smaller functions of manageable size. You now have the tools you need to do this.

In this course, you’ve learned:

  • How to create a user-defined function in Python
  • Several different ways you can pass arguments to a function
  • How you can return data from a function to its caller
  • How to add documentation to functions with docstrings and annotations

For more information about topics covered in this lesson, you can check out these resources:

Download

Sample Code (.zip)

12.9 KB
Download

Course Slides (.pdf)

2.9 MB
Avatar image for silvanog31560

silvanog31560 on Aug. 9, 2021

Thank you for this course, it was great! I am sure that once I get some practice I will come back to review this again!

Avatar image for aniketbarphe

aniketbarphe on Sept. 11, 2021

Great Course!

Avatar image for Premkumar

Premkumar on April 15, 2022

Thanks for the detailed course.

Avatar image for Brandon Hopkins

Brandon Hopkins on April 23, 2023

Thank you. You’re a great teacher.

Avatar image for ffh

ffh on Aug. 13, 2023

Great course. Very detailed. I will need some practice and come back to your course. Many thanks

Avatar image for alnah

alnah on Sept. 24, 2023

I’ve observed that the course is extensively structured, and really, it covers a lot and it’s great! But it allocates a considerable amount of time to elementary concepts, which may seem obvious to those who have advanced to this stage in the learning path. Additionally, some topics addressed seem tangential to the core objectives of the course.

At times, it appears that the instructor prioritizes showcasing its expertise in Python over delivering instructional content that is accommodating to beginners. The references to C++, for instance, can be perplexing for individuals still familiarizing themselves with Python syntax. This instructional approach also contributes to ambiguity regarding distinctions between side effects and return statements, as well as the concepts of mutable and immutable objects in function scope.

The course often lacks practical examples, giving the impression of being more theoretical, akin to a computer science course discussing functional programming through Python, rather than a hands-on guide on applying functional programming in Python. A particularly complex section delves into modifying annotations with the dunder method, leaving me seeking clarity on its real-world application, such as in API design.

Furthermore, the portion on enforcing type checking seems hurried and might benefit from further elaboration. Alternatively, considering its pace, it might be more beneficial to omit this section altogether, as it can be overwhelming, and leave it for another part of the learning path.

I trust this feedback will be constructive and assist in refining the course to better accommodate learners who are relatively new to these concepts. Despite the challenges, I managed to complete the course through additional videos and readings. I believe revising this course would be advantageous for subscribers to Real Python.

Avatar image for rwelk

rwelk on April 18, 2024

Being new to python I found this course very informative. I intend to start Defining Your Own Python Function next on my learning path. Thank you for this video course.

Become a Member to join the conversation.