1/31
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Code
giving comands to a computer
function
code that breaks a program into smaller parts, makes the program easier to understand, and allows the avoidance of repeating code over and over. A function name is all lower case, words are separated with a underscore, and the name should start with an action verb.
Precondition
what must be true before a function is called
postcondition
what should be true after a function is called
Decomposition
breaking code down into smaller parts that are easy to understand
Top down desgin
breaking down a problem into smaller problems
comment
text used to help another reader understand the code in a program
ex For a single line # Comment, For multiple lines: ““Comment””
Abstraction
to reduce complexity
ex: creating a function
API (application programming interface)
a set of tool for building software (program)
Ex Python
Bug
a mistake in a program
Conditional
a statement that returns a true or false answer
Syntax
the rules of programming language
Debugging
searching for syntax error
Algorithm
a step by step set of instructions to solve a problem
iteration
a specific number of repetitions
Program Quality
the quality of a program is based on its level of efficiency and clarity
Pseudocode
writing out our agorithm in english-like code to help us figure out how to write the program
Parameter
an input into function We can pass a parameter to a function to make it do specific things
Control Structures
a control structure is a block of code that determines the flow of execution based on ceratin conditions
Ex if statments, if-else statement, for loop and whilel loop.
def move_twice():
move()
move()
defines a function called move_twice. This function willl make Karel move forward two times. Don’t forget the colon “:” at the end.
for i in range(5):
creates a loop that goes through 5 iterations of a specific sequence of code. Don’t forget the colon “:” at the end
Abstractions
Managing complexity by 'abstracting away' information and detail, to focus on the relevant conceptsÂ
High level of abstraction, few words/short sentenceÂ
Low Level of abstraction, very detailed and longer
Documentation
provides information to show programmers how to use it
For Loops
The For Loop lets karel repeat a secretion of code fixed number of times
For Loop=repeat a fixed number of times
All programming languages have for loops
If/Else Statements
To do something if a condition is true and do something else if the condition is false
While Loops
While loops allow us to repeat a section of code as long as some condition is true
While Loops=repeat as long as conditions is true
Control structures
Control the flow of the program; how the commands execute.
If statement
If-Else statement
Repeat Code
For Loop
While Loops
Syntax error
Program does not start running
Runtime error
Program starts running, but crashes when running
Logic error
Program starts running, but does not do what it is supposed to do
Sequencing
Step-by-step execution of instructions under the orders that they are given
Selection
Using a condition to determine which part of the algorithm is executedÂ