Fichas
programming
Fichas del conjunto (13)
- 1ProgrammingProgramming is simply providing instructions to a computer to solve a problem
- 2Problem SolvingThe main skill that programming requires is problem solving
Often we don’t know how to solve the problem, but we know how to make a start – getting things wrong then trying something different is a big part of it. - 3PythonPython is a programming language
Instructions are written using Python, which the computer then executes
Python is one of the most widely used programming language and is supported on nearly every device - 4penup()tells the turtle to stop drawing, so it can be moved about without leaving a line
- 5pendown()tells the turtle to start drawing, so lines can be created
- 6pencolor()can be used to change the colour of the line that is drawn by the turtle
- 7fillcolor("colour") begin_fill() end_fill()The fill colour is set with fillcolor()
Only shapes drawn between begin_fill() and end_fill() will be coloured in - 8Pattern RecognitionOne of the principals of computational thinking is pattern recognition.
If we can spot a repeating pattern in our code, there is usually a way to make it more efficient - 9LoopsWhen we spot a repeating pattern, we can use a loop to make the code repeat, rather than typing it out multiple times
To loop code n times, we use the code,
for x in range(n): - 10ProcedureWe can define a procedure using the def command
We can define a procedure anywhere in the code, as long as it’s defined before it’s used
The code shown defines a procedure called “drawPentagon()”, which is used later in the program - 11basic codeimport turtle
sc = turtle.Screen()
kevin = turtle.Turtle()
kevin.right(144)
kevin.forward(200)
kevin.right(144)
kevin.forward(200) - 12loop codeimport turtle
sc = turtle.Screen()
kevin = turtle.Turtle()
for x in range(2) :
kevin.right(144)
kevin.forward(200) - 13procedure codedrawpentagon()
kevin.penup()
kevin.goto(20,20)
kevin.pendown()
drawpentagon()
kevin.penup()
kevin.goto(20,-20)
kevin.pendown()
Información
- Descripción
- Year 8 Computing Fichas sobre programming, creado por Charlotte Chandler el 24/05/2021.
- Creado por
- Charlotte Chandler
- Visitas
- 6
- Historial
-
- Creado por Charlotte Chandler · 24 may 2021
- Copiado por Charlotte Chandler · 24 may 2021
- Valoración