apcsp

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

functions

  1. Avoid repeated code

  2. Break program into smaller parts

    • Simplify problem solving process

  1. Make program more readable

  2. Functions = helps make karel turn right

2
New cards

Top Down Design/Decomposition

  • Decomposing program into readable tiny parts

  • - Big messy functions < small simple functions

  • Helps solve large complicated problems

  • Lets us collab by splitting problem into subproblems that can be solved independently

3
New cards

Comments on Code

  1. Good style = clean + reasonable

  2. Notes explaining the code to reader

i. Preconditions = must be true before function

ii. Postconditions = must be true after function

4
New cards

Abstraction

  1. "Abstracting away" complex info to be relevant

  2. Defines program steps, but not how exactly

i. write functions to "abstract away" picky details

5
New cards

AP| = Application Programming Interface

  1. Set of tools for building programs

  2. Karel = API built by Python that abstracts her
    code

6
New cards

For Loops

  • repeated fixed # of times

  • for i in range (#): move()

7
New cards

Bug

Mistake in Code

8
New cards

Conditionals

  1. function returning a T/F answer

    • Front clear? Balls present? Facing east?

  2. If/Else Statements

    • For different worlds: specific < general

  3. While Loops: repeat code IF condition is true

9
New cards

Control Structures

  1. Ask Questions: If & If/Else Statements

  2. Repeat Code: For & While Loop

10
New cards

Debugging Strategies

  • Pay attention to details (typos…)

  • Question all assumptions

11
New cards

Error Types

  1. Syntax: program no run

  2. Runtime: program run then crash

  3. Loop: program run then confused (no message)

12
New cards

Algorithms?

Step by step set of instructions to solve problem

13
New cards

All algorithms made with

  • Sequence, Iteration, Selection (efficiency + clarity)

14
New cards

Sequence

step by step execution in given order / natural program flow

15
New cards

Iteration

repeating instructions (for/while loops)

16
New cards

Selection

choosing which instructions to do (if & if/else statements)

17
New cards

Problem Solving Process

Natural language < Pseudocode < Program

18
New cards

Pseudocode

Writing out algorithm plainly to help write program

19
New cards

Parameters : color[“red”]

  • Inputs into functions

    • we can pass parameters to a function to make it do specific things