1/82
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Computer Programming
detailed, step by step set of instructions telling a computer exactly what to do
Software
programs
Hardware
the physical machine
Anaylsis
process of examining algorithms and problems mathematically
CPU only accesses information stored where?
main memory (RAM or random access memory)
What type of memory does not hold storage when it loses power
Main Memory
Humans & Computers interaction through what?
input/output devices
Examples of input/output devices
keyboard, mouse, microphone, etc.
Operating Software
suite of software that controls the various hardware resources of a computer
Examples of operating software
Windows, mac OS, Linux
Bootstrap Loader
small program that is initially loaded into RAM when the computer is first turned on or restarted
Syntax
programming languages ‘precise form’ / grammar
Semantics
it’s precise meaning
Compiler
complex computer program that takes another program written in high level language and translates it into an equivalent program in the machine language of the same computer
Source Code
the high-level program
Interpreter
program that stimulates a computer that understands high level language
High level languages are more…
portable
What are needed every time in interpreting
the interpreter and the source code
Advantages of interpreters
more flexible programming and can be run interactively
Compiling is…
one shot translation
Advantages of compiling
can be run over and over again without repeated need for a compiler or source code, it’s also faster
print()
prints a blank line
fn+f5 automatically….
runs a function
What are the parts of the process of writing code?
Analyze the problem, determine specifications, create a design, implement the design, test/debug, and maintain
Analyze the problem
What are we trying to solve?
Determine the specifications
What will our program accomplish?
Create a design
Figure out the overall design of your program
Implement the design
Turn the design into computer language
Test/Debug
Find errors and fix them
Maintain
develop for the needs of your user
Names
must begin with “_” or a letter, no spaces, case sensitive, cannot use python keywords
Examples of python keywords
False, True, await, else, is, or, not, etc.
Expressions
fragments of code that produce or calculate new data values
Literal expressions
used to indicate a specific value
String Expressions
a sequence of printable characters (“ “)
Evaluation
turning an expression into an underlying data type
Operators
+, -, * , /, //, **, %
Concatenation
adding strings together
/n
new line
Evaluate an identifier numerically
eval()
commas
add spaces
Functions
objects that take inputs and return outputs
functions have…
parameters
end = “ “
Will end code on the same line
Assigning a literal to an identifier is as easy as…
setting the two equal
%
Modules. The remainder left over, ex. 5%2 = 1
//
Integer division. ex. 5//2 = 2
type()
tells you whether something is an int, a float, or a string
int
tells the reader that the value cannot be a fraction
float type
can only represent approximations to real numbers, includes decimals
operations on floats produce…
floats
operations on ints produce…
ints
int()..
truncates
round(x, y)
x = number, y= number of decimal points rounded to, it can be negative
Computer stores floats in…
binary
typecast
converting int, float, and str into int, float, or str
Object oriented
a sort of active data type that combines both data and operations
AKA Objects…
know stuff and do stuff
Opening a graphics window
win = GraphWin(“x”,y,z) where x = name of the window, and y and z are the size
win.close()
closes the window
GraphWin is by default what size?
200 × 200 pixels
__.draw(win)
draws the object
Class
describes the properties the instance (object) will have
Constructor
an expression that creates a brand new object
Methods
the set of messages that an object responds to
Accessor Methods
allows you to get information from the instance variables
Examples of accessor methods
p.getX(), p.getY()
Mutator Methods
methods that change the state of an object
Example of mutator methods
move()
Aliasing
when two different variables refer to exactly the same object and changes that are made to one variable also occur on the others
duplicates an object
_.clone()
set coordinates
win.setCoods( , , , )
Initially, (0,0) is where
Top left hand corner
API
Applications Programming Interface
what does autoflush=False do?
turns off automatic updating of a window
What question does computer science answer?
What can be computed?
Real-world chaotic behavior example
butterfly effect - computer models used to simulate and predict weather patterns are so sensitive that the effect of a single butterfly flapping its wing may make a difference
Location (address)
a string of numbers and letters, the place in a computer memory where this function’s definition is stored
Difference between high-level computing language and a low level one
high level is more portable
IPO
input, process, output
Garbage collection in python
Python automatically takes values that are no longer referred to by any variable and clears them out of the memory, opening space for new values
Accumulator
an accumulator is an algorithmic pattern that keeps track of the running total while doing repeated calculations
How does python deal with large integers
A python integer is not a fixed size and expands to accommodate the value it holds and as an integer value gets bigger, Python automatically converts to a representation using more bits