cS Flashcards

(40 cards)

1
Q

What is Python?

A

A highly popular text-based programming language used by many large organizations like Facebook, NASA, IBM, Google, and Yahoo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the first step in setting up for this unit?

A

Create a new folder called ‘Algorithms and Control’ in the path: Computer&raquo_space; Your Drive&raquo_space; KS3&raquo_space; Year 8&raquo_space; Computing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a library in Python?

A

A set of extra functions that help perform different types of tasks, such as advanced maths, graph drawing, and game writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the command ‘tess.forward(100)’?

A

It moves the turtle named ‘tess’ forward by 100 units.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What command is used to change the background color in the Turtle graphics window?

A

wn.bgcolor(‘lightgreen’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Fill in the blank: A _______ is a function to perform a specific task in programming.

A

Function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of comments in Python code?

A

To explain what is happening in the code and improve readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the command ‘tess.left(90)’ do?

A

It rotates the turtle named ‘tess’ 90 degrees to the left.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the significance of indentation in Python?

A

It indicates which instructions are part of a control structure, such as loops or conditionals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the ‘mainloop()’ function do in the Turtle graphics program?

A

It waits for the user to close the graphics window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the use of the ‘input()’ function in Python?

A

To take user input and store it in a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What will happen if you change the ‘range’ number to 360 in a drawing loop?

A

It will repeat the drawing instructions 360 times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: The command ‘tess.clear()’ removes all drawings from the Turtle graphics window.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the command ‘tess.home()’ do?

A

It moves the turtle back to the center of the screen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a parameter in the context of functions?

A

A value that is passed to a function when it is called, allowing the function to use that value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of the ‘def’ keyword in Python?

A

To define a new function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Fill in the blank: The _______ function is used to draw a square in the Turtle graphics program.

18
Q

What does the line ‘tess.left(360/4)’ accomplish in the drawing of a square?

A

It rotates the turtle 90 degrees after drawing each side of the square.

19
Q

What is the structure of an ‘if’ statement in Python?

A

It checks a condition and executes code based on whether the condition is true or false.

20
Q

What does the command ‘drawsquare(50)’ do?

A

Calls the drawsquare function to draw a square with side length of 50.

21
Q

What is the purpose of the ‘for’ loop in the context of drawing shapes?

A

To repeat a set of instructions a specific number of times.

22
Q

True or False: You can only create one function per program in Python.

23
Q

What is the output of ‘print(‘That’ll be a ‘ + shape_name + ‘.’)’ when shape_name is ‘triangle’?

A

That’ll be a triangle.

24
Q

What is the role of the ‘import turtle’ statement?

A

It imports the Turtle graphics library to be used in the program.

25
Fill in the blank: In Python, the command 'wn.title('Turtle Power')' sets the _______ of the graphics window.
title
26
What is the purpose of the 'range' function in a loop?
To generate a sequence of numbers that the loop will iterate over.
27
What does 'tess.pensize(5)' do?
Sets the thickness of the lines drawn by the turtle named 'tess'.
28
Why should you avoid naming your program 'turtle.py'?
It conflicts with the Turtle graphics library and causes the code to not work.
29
What is the modified code for the 'for' loop to change the square size?
for myMoves in range(8): drawsquare(squareSize) squareSize += 10 tess.left(45) ## Footnote This modification allows the square size to increase with each iteration.
30
What is the purpose of passing multiple parameters in functions?
It allows for more flexibility and customization in function behavior and output. ## Footnote For example, passing both side length and color to a drawing function enhances its versatility.
31
What does the function 'drawsquare(sideLength, newColour)' do?
Draws a square of a specified side length and color. ## Footnote The function uses a loop to create the four sides of the square.
32
Fill in the blank: A standard variable is handy for storing a _______.
single piece of information.
33
List the operations that can be performed on a list in Python.
* append * sort * reverse * pop ## Footnote These operations allow for dynamic manipulation of list contents.
34
What does the 'len()' function do?
It returns the number of items in a list or the number of characters in a string.
35
What is the purpose of the 'colouredSquare' function?
To draw a square of a specified side length in a specified color.
36
True or False: The turtle can draw without having its pen down.
True
37
What is the task for the Silver level challenge?
Modify the code so that it starts with a growingSide of 5, and doubles each time a new square is drawn.
38
What is the Platinum level challenge regarding polygon drawing?
Add an ultimatePoly() function that takes side length, number of sides, line color, and line thickness.
39
What does the turtle's 'pensize' control?
The thickness of the lines drawn by the turtle.
40
What is the purpose of the 'while' loop in the Platinum task?
To allow the user to input an indefinite number of colors for drawing shapes.