Exercise 1 - The Print Function
Goals
- Open, edit, save, and run code
- Utilize builtin functions of Python/CircuitPython
Preparation
- Connect your board to the computer and open the
code.py
file. Delete any pre-existing code from the board. See getting started for help with this step.
Concepts & Vocabulary
- Calling functions
print()
- argument(s)
Background Info
This is a very, very simple piece of code, but it'll be a great way to make sure you understand how to run code. Besides, you'll be using the print()
function a lot, so I want to make sure you nderstand it!
The term for using a function is "calling" a function. So for instance, we will call the print()
function in this exercise.
Remember that every function has an input, a process, and an output. A function call will start with the name of the function. In this case, the name is print. The name must always be followed by parentheses ()
for the input, even if you're not going to be putting anything inside them. If a function takes arguments, they go inside the parentheses. If there's more than one argument, you separate them with commas.
Try It
Please take a moment to see if you can predict what this will do before you run the code.
Show me your code in action
To get credit for this exercise, I will need to see your code running. This will be scored for completion. If I am not available to check your work when you're ready, make sure you use Save As
to save a copy on your computer (not only on the board!) so you can continue on and show me the code running later.