What is a Function
Defining a function
Calling a function
Built-In vs User-Defined
Tracy's World and Loops
100

What is a function?

A function is a way to group a set of commands so they can be called with one line of code

100

How do you declare a function?

You declare a function using the syntax def function_name_here():

100

How do you call a function?

You call a function by using its name followed by parentheses, like 

function_name()

100

What is a built-in function?

A built-in function is an action that can be called without needing to define it, those Tracy already knows how to perform

100

Tracy starts where in her world and facing which direction?

Tracy starts at 0,0 in the middle of her world facing to the right

200

What is the purpose of functions?

Functions help us shorten our code, make it reusable, and improve readability

200

What does indentation mean in functions?

Indentation in functions indicates which commands belong to the function, making the code organized and readable

200

What happens if you call a function not defined?

If you call a function that is not defined, an error will occur stating that the function is not recognized

200

Give an example of a user-defined function.

def draw_square():

def draw_two_circles():

def draw_big_rectangle():

These functions define new actions using commands

200
In the built-in function circle(50), what does 50 represent?

The circles radius

300

Give an example of a built-in function

circle()

forward()

penup()

pendown()

300

What is the syntax to call a function?

The syntax to call a function is 

function_name()

300

How many times a function be called in a program?

A function can be called as many times as you need it to used in a program.

300

What's the difference between built-in and user-defined functions?

Built-in functions are predefined in the system, while user-defined functions are created by the programmer

300

What is the correct syntax to create a loop that will run 4 times?

for i in range(4):

400

What does it mean to define a function?

To define a function means to declare it using the syntax 

def function_name_here(): followed by its commands.

400

What is wrong with the following function name:

Big_blue_circle():

It does not follow the naming guideline of not starting with a capital letter

400

What is the first line of code that would be executed in the following program:

The first line of code to execute is line 6 when the function draw_square() is called

400

Name one of the built-in functions in the following program.

for i in range(3):

forward(50)

left(120)

400

What does the 'i' in for i in range(2): represent?

iteration

500

Why are functions reusable?

Functions are reusable because they can be called multiple times without rewriting the code.

500

Create a function to have Tracy draw a square?

500

What would be the output of the following program:

This program has an error in line 6 so it will state there is an error and nothing will be drawn

500

How do you create a user-defined function?

You create a user-defined function using the def keyword followed by the function name and its commands

500

What is the value of "i" the first time a loop runs?

0