Skip to main content
HomePython

Introduction to Functions in Python

4.6+
175 reviews
Beginner

Learn the art of writing your own functions in Python, as well as key concepts like scoping and error handling.

Start Course for Free
3 hours10 videos44 exercises430,096 learnersTrophyStatement of Accomplishment

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
Group

Training 2 or more people?

Try DataCamp for Business

Loved by learners at thousands of companies


Course Description

It's time to push forward and develop your Python chops even further. Python has tons of fantastic functions and a module ecosystem. However, as a data professional or developer, you'll constantly need to write your own functions to solve problems that are dictated by your data. You will learn the art of function writing in this first course. You'll come out of this course being able to write your very own custom functions, complete with multiple parameters and multiple return values, along with default arguments and variable-length arguments. You'll gain insight into scoping in Python, be able to write lambda functions and handle errors in your function writing practice. You'll wrap up each chapter by using your new skills to write functions that analyze Twitter data.
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.
DataCamp for BusinessFor a bespoke solution book a demo.

In the following Tracks

Certification Available

Associate Data Scientist in Python

Go To Track
  1. 1

    Writing your own functions

    Free

    You'll learn how to write simple functions, as well as functions that accept multiple arguments and return multiple values. You'll also have the opportunity to apply these new skills to questions commonly encountered by data professionals and developers.

    Play Chapter Now
    User-defined functions
    50 xp
    Strings in Python
    50 xp
    Recapping built-in functions
    50 xp
    Write a simple function
    100 xp
    Single-parameter functions
    100 xp
    Functions that return single values
    100 xp
    Multiple parameters and return values
    50 xp
    Functions with multiple parameters
    100 xp
    A brief introduction to tuples
    100 xp
    Functions that return multiple values
    100 xp
    Bringing it all together
    50 xp
    Bringing it all together (1)
    100 xp
    Bringing it all together (2)
    100 xp
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.

In the following Tracks

Certification Available

Associate Data Scientist in Python

Go To Track

datasets

Tweets

collaborators

Collaborator's avatar
Francisco Castro

prerequisites

Intermediate Python
Hugo Bowne-Anderson HeadshotHugo Bowne-Anderson

Data Scientist

Hugo is a data scientist, educator, writer and podcaster formerly at DataCamp. His main interests are promoting data & AI literacy, helping to spread data skills through organizations and society and doing amateur stand up comedy in NYC. If you want to know what he likes to talk about, definitely check out DataFramed, the DataCamp podcast, which he hosted and produced.
See More

Don’t just take our word for it

*4.6
from 175 reviews
76%
13%
8%
3%
1%
  • Thuthukani N.
    23 days

    I would have liked more lambda examples. It is complex, but doable with examples.

  • Mihaela G.
    about 1 month

    Made the learning experience fun and insteresting. Clearly explained concepts, followed by practical examples to help reinforce them. All in all, a very good introductory course that motivates me to keep on learning.

  • Ranjith V.
    about 1 month

    One of the best learning materials to under the scope of functions. The mix of videos explaining the content and immediately followed by practical work is well built to facilitate the learning.

  • Douglas D.
    about 1 month

    Very clear. It should be easier to find reference material

  • Rafael A.
    about 2 months

    It was amazing!!! Simple, practice and very easy to understand. I think in all lessons should have flash cards, It would be easier to review the previous lessons.

"I would have liked more lambda examples. It is complex, but doable with examples."

Thuthukani N.

"Made the learning experience fun and insteresting. Clearly explained concepts, followed by practical examples to help reinforce them. All in all, a very good introductory course that motivates me to keep on learning."

Mihaela G.

"One of the best learning materials to under the scope of functions. The mix of videos explaining the content and immediately followed by practical work is well built to facilitate the learning."

Ranjith V.

FAQs

Join over 15 million learners and start Introduction to Functions in Python today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.