week 7 functions with turtle graphics Flashcards

1
Q

turtle graphics

A

python module for learning drawing

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

importing turtle module syntax

A

import turtle
import random

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

setting up turtle screen

A

s = turtle.getscreen()

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

setting up turtle object

A

t = turtle.Turtle()

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

change color of screen

A

originally black, but can be changed with the following function

s.bgcolor(‘blue’)

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

turtle screen

A

center is (0,0), like a graph (100 is typically a quarter of the way through)

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

customize turtle

A

you can customize speed, shape, fill color, pen color, and width

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

customize turtle syntax

A

t.width(5)

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

function

A

‘blueprint’ you can call onto later to repeat a chunk of code many times

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

function syntax

A

def funName():
# function body

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

function call syntax

A

funName()

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

how do you call a function repeatedly?

A

with a for loop

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

purpose of a function

A

improve code readability, reduce redundancy, facilitate modular/incremental programming

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

function parameters

A

assigns variables that are defined when function is called

basically input arguments and what they are called in terms of the function

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

random.randint()

A

randomly generates integers between and including two arguments

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

computational thinking

A

creating series of instructions to solve a problem

16
Q

algorithm

A

series of instructions that solves a specific problem

17
Q

def keyword

A

used to define new functions

18
Q

return statement

A

used so function can return a value (can appear anywhere in function body and can have multiple return statements)

19
Q

None

A

keyword that means no value, if function doesn’t have return it outputs None

20
Q

arguments

A

value provided to the function’s parameters during the function call

21
Q

hierarchal/nested function calls

A

function call inside of a function call
i.e int(input())

22
Q

void function

A

function that doesn’t return anything

23
Q

polymorphism

A

using multiplication operator to repeat a section of text/char multiple times in print statement (python only)

24
Q

dynamic typing

A

determines type of objects as program executes (python)

25
Q

static typing

A

requires program to declare type and program parameters in the source code (C, C++, Java)

26
Q

modular development

A

dividing program into separate modules that are individually developed and tested before being integrated into a single program

27
Q

function stub

A

function definition who’s statements have not yet been written (placeholder)

28
Q

pass function

A

does nothing and returns nothing, can be used as a placeholder for function body until it’s written

29
Q
A