wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Functions

Total questions: 16

Worksheet time: 9mins

Name
Class
Date
1.
Which of the names below follow all naming rules? / ¿Cuál de los siguientes nombres sigue todas las reglas de nomenclatura?
a)
make_two_squares
b)
2_squares
c)
Make 2 Squares
d)
special_function
2.
True of False? Functions are a way to group a set of commands so they can be called with one line of code. / ¿Verdadero o falso? Las funciones son una forma de agrupar un conjunto de comandos para que puedan llamarse con una línea de código.
a)
True
b)
False
3.
Sara will study for a test if it is scheduled for tomorrow or if it covers difficult material. Otherwise, she will relax and watch TV instead of studying. In which of the following scenarios will Sara relax and watch TV instead of studying? / Sara estudiará para un examen si está programado para mañana o si cubre material difícil. De lo contrario, se relajará y mirará televisión en lugar de estudiar. ¿En cuál de los siguientes escenarios Sara se relajará y verá televisión en lugar de estudiar?
a)
The test is 3 days away and covers easy material. / Faltan 3 días para la prueba y cubre material fácil.
b)
The test is tomorrow but covers easy material. / El examen es mañana pero cubre material fácil.
c)
The test is in 2 days and covers difficult material. / La prueba es en 2 días y cubre material difícil.
d)
The test is tomorrow and covers difficult material. / La prueba es mañana y cubre material difícil.
4.
Which of the names below follow all naming rules? / ¿Cuál de los siguientes nombres sigue todas las reglas de nomenclatura?
a)
Draw Four Circles
b)
4_circles
c)
my_function
d)
make_four_circles
5.

John will go for a run if it is sunny or if he has free time. Otherwise, he will stay at home and read a book. In which of the following scenarios will John stay at home and read a book? / John irá a correr si hace sol o si tiene tiempo libre. De lo contrario, se quedará en casa y leerá un libro. ¿En cuál de los siguientes escenarios John se quedará en casa y leerá un libro?

a)

It is raining and John is busy. / Está lloviendo y John está ocupado.

b)

It is sunny but John is busy. / Hace sol pero John está ocupado.

c)

It is cloudy and John has free time. / Está nublado y John tiene tiempo libre.

d)

It is sunny and John has free time. / Hace sol y John tiene tiempo libre.

6.

Which of the names below follow all naming rules? / ¿Cuál de los siguientes nombres sigue todas las reglas de nomenclatura?

a)

draw_five_triangles

b)

5_triangles

c)

Draw 5 Triangles

d)

special_function_2

7.

When defining a function, the definition must occur before it is called. / Al definir una función, la definición debe ocurrir antes de que se llame.

a)

True

b)

False

8.

What character should be placed at the end of the function "def" line, after the parentheses? / ¿Qué carácter se debe colocar al final de la línea de función "def", después del paréntesis?

a)

Hashtag (#)

b)

Colon(:)

c)

Exclamation (!)

d)

Dash (-)

9.

Which of the following is NOT a Python rule for naming functions? / ¿Cuál de las siguientes NO es una regla de Python para nombrar funciones?

a)

Functions names can contain letters, numbers and underscores

b)

Function names must be less than 32 characters

c)

The first character in a function name cannot be a number

d)

Function names are case-sensitive

10.

True or False? In Python, function names are case-sensitive. / ¿Verdadero o falso? En Python, los nombres de las funciones distinguen entre mayúsculas y minúsculas.

a)

True

b)

False

11.
If you wanted Tracy to complete her command very slowly, which speed value would you use? / Si quisieras que Tracy completara su comando muy lentamente, ¿qué valor de velocidad usarías?
a)
0
b)
1
c)
5
d)
10
12.
What are the (x,y) coordinates for point C? / ¿Cuáles son las coordenadas (x,y) del punto C?
a)
(40, 80)
b)
(-40, 80)
c)
(-40, -80)
d)
(40, -80)
13.
The setposition() command moves Tracy to a coordinate and: / El comando setposition() mueve a Tracy a una coordenada y:
a)
turns her to face left / la gira hacia la izquierda
b)
does not turn her / no la convierte
c)
turns her to face up / la pone boca arriba
d)
turns her to face down / la pone boca abajo
14.
If you want three circles to be drawn next to each other (as seen in the image below), after drawing the first circle, how far would you need to move Tracy before drawing the next circle? / Si quieres dibujar tres círculos uno al lado del otro (como se ve en la imagen a continuación), después de dibujar el primer círculo, ¿qué distancia tendrías que mover a Tracy antes de dibujar el siguiente círculo?
a)
100 pixels
b)
50 pixels
c)
The circle’s radius / El radio del círculo
d)
The circle’s diameter / El diámetro del círculo.
15.
If you wanted Tracy to complete her command immediately, which speed value would you use? / Si quisieras que Tracy completara su comando inmediatamente, ¿qué valor de velocidad usarías?
a)
0
b)
1
c)
5
d)
10
16.
If I use the command right(180), which way will Tracy turn? / Si uso el comando derecho (180), ¿hacia dónde girará Tracy?
a)
She will turn in a circle / Ella girará en círculo
b)
She will turn around / Ella se dará la vuelta
c)
She will turn to face up / Ella se pondrá boca arriba
d)
She will turn to face left / Ella girará hacia la izquierda.