Flashcards
PROGRAMMING
Flashcards do conjunto (17)
- 1import turtleImports the turtle library, to make turtle functions available
- 2wn = turtle.Screen()Creates a window to draw in
- 3daisy = turtle.turtle()Creates a turtle named daisy
- 4daisy.forward/left/right(90)moves daisy forward/left/right 90 pixels
- 5pythonprogramming language
Instructions are written using Python, which the computer then executes - 6problem solvingThe main skill that programming requires is problem solving
- 7programmingproviding instructions to a computer to solve a problem
- 8penup()tells the turtle to stop drawing, so it can be moved about without leaving a line
- 9pendown()tells the turtle to start drawing, so lines can be created
- 10pencolor()used to change the colour of the line that is drawn by the turtle
- 11fillcolor()fill the colour of shape you are creating
- 12begin_fill() / end_fill()begging or stopping to fill the shape
- 13loop example: for x in range (5):make the code repeat, rather than typing it out multiple times
- 14drawPentagon() (CAN BE ANY SHAPE)code for drawing any shape without having to type out so many procedures
- 15goto() example : (20,-20)to draw the shape you would like several times
- 16size/sidesWhen we use the function, we can tell it what number to use for sides, and what number to use for size
- 17example of what end result should look like:import turtle
sc = turtle.Screen()
kevin = turtle.Turtle()
def drawShape(sides,size):
for x in range (sides)
kevin.forward(size)
kevin.left(360/sides)
Informações
- Descrição
- FlashCards sobre PROGRAMMING, criado por Ruby Johnson em 24-05-2021.
- Criado por
- Ruby Johnson
- Visualizações
- 4
- Avaliação