cS Flashcards
(40 cards)
What is Python?
A highly popular text-based programming language used by many large organizations like Facebook, NASA, IBM, Google, and Yahoo.
What is the first step in setting up for this unit?
Create a new folder called ‘Algorithms and Control’ in the path: Computer»_space; Your Drive»_space; KS3»_space; Year 8»_space; Computing.
What is a library in Python?
A set of extra functions that help perform different types of tasks, such as advanced maths, graph drawing, and game writing.
What is the purpose of the command ‘tess.forward(100)’?
It moves the turtle named ‘tess’ forward by 100 units.
What command is used to change the background color in the Turtle graphics window?
wn.bgcolor(‘lightgreen’)
Fill in the blank: A _______ is a function to perform a specific task in programming.
Function
What is the purpose of comments in Python code?
To explain what is happening in the code and improve readability.
What does the command ‘tess.left(90)’ do?
It rotates the turtle named ‘tess’ 90 degrees to the left.
What is the significance of indentation in Python?
It indicates which instructions are part of a control structure, such as loops or conditionals.
What does the ‘mainloop()’ function do in the Turtle graphics program?
It waits for the user to close the graphics window.
What is the use of the ‘input()’ function in Python?
To take user input and store it in a variable.
What will happen if you change the ‘range’ number to 360 in a drawing loop?
It will repeat the drawing instructions 360 times.
True or False: The command ‘tess.clear()’ removes all drawings from the Turtle graphics window.
True
What does the command ‘tess.home()’ do?
It moves the turtle back to the center of the screen.
What is a parameter in the context of functions?
A value that is passed to a function when it is called, allowing the function to use that value.
What is the purpose of the ‘def’ keyword in Python?
To define a new function.
Fill in the blank: The _______ function is used to draw a square in the Turtle graphics program.
drawsquare()
What does the line ‘tess.left(360/4)’ accomplish in the drawing of a square?
It rotates the turtle 90 degrees after drawing each side of the square.
What is the structure of an ‘if’ statement in Python?
It checks a condition and executes code based on whether the condition is true or false.
What does the command ‘drawsquare(50)’ do?
Calls the drawsquare function to draw a square with side length of 50.
What is the purpose of the ‘for’ loop in the context of drawing shapes?
To repeat a set of instructions a specific number of times.
True or False: You can only create one function per program in Python.
False
What is the output of ‘print(‘That’ll be a ‘ + shape_name + ‘.’)’ when shape_name is ‘triangle’?
That’ll be a triangle.
What is the role of the ‘import turtle’ statement?
It imports the Turtle graphics library to be used in the program.