O'Reilly logo

Python Projects for Kids by Jessica Ingrassellino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Build your own function – name()

So, you have learned about variables and how they store information. You have also learned about how these variables can be used inside of a function. Finally, you have learned how to use special Python functions, such as input(), to help get information from users and store it in the computer. You are ready to build your own function using variables and input().

Set up your project file

The function that we will build now is called name(). The purpose of this function will be to ask the user their name, store (remember) the name, and then print out a friendly message to the user.

To start this function, do the following:

  1. Open a new file in your text editor.
  2. Go to Save and name the file name.py.

    Tip

    You need to use

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required