Python Coding (turtle) Flashcards
What is python
Text-based program language, which means you will need to be typing specific commands into a window to get the computer to do what you want it to.
How to create a folder
Computer»_space; Your H: Drive»_space; Year 9»_space; Computer Science
What is turtle
Allows convenient drawings of lines and shapes
What is the first thing you type in to import the graphic window which we use to draw into?
import turtle
wn = turtle.Screen()
What do you type in to change the background colour and to add a title on the window?
wn. bgcolor(“lightgreen”)
wn. title(“Turtle Power”)
What to type to choose a colour of the turtle, and the pensize(the thickness of the line)?
tess = turtle.Turtle() tess.color("hotpink") tess.pensize(5) tess.shape("turtle") We have to call our turtle a name in this we call it ‘tess’
Which command will display the text ‘Hello world!’ on the screen?
print(“Hello world!”)
What command will correctly ask the user for their age?
age = input(“How old are you?”)
What function will convert a number to a string?
str()
What is the result of this command? print (“5” + “3”)
53
Which function will convert a string containing only digits into a number?
int()
Which decision statement will be triggered if the variable x is less than 20
if x < 20: