Python Final Exam Flashcards
Program
sequence of instructions that specifies how to perform a computation
Computation
mathematical computation -> data processing, aka software
Hardware
physical parts that make up a computer
Typical hardware components
Central processing unit (CPU)
* Main memory (RAM)
* Secondary storage devices (HD)
* Input and output devices
Application software
Programs that make computer useful for
business and users
* Word
* Excel
* Photoshop
* Outlook
* Chrome
* iTunes
System Software
Operating system
* Controls hardware
* Windows, MacOS, Linux, IOS, Android
Utilities
* Enhance or protects the computer
* Anti-virus, 7-zip, Parallels
Software development tools
* Create and modify software
* IDLE, Visual Studio, IntelliJ IDEA
Low-level language
Close in nature to machine language
* Computer architecture specific. Not portable.
FORTRAN, COBOL, and C
High-level language
Allows simple creation of powerful and complex programs
* Agnostic to the computer architecture. Portable code.
Python, PHP, Java, C++, Ruby.
What types of processes do we have?
Math, conditions, repetition
Algorithm
set of step-by-step instructions that detail a process or
computation
(set of logical, well-defined rules or procedures for efficiently and
accurately solving a problem)
Pseudocode
informal high-level description of the structure of an
algorithm
* Written in a combination of natural language and programming
language constructs.
Flowchart elements
terminal symbol = oval
processing symbol = rectangle
decision symbol = diamond
input/output = slanted rectangle
Python Advantages
High-level language
Extensible (lots of packages)
Versatile
Emphasis on style & readability
No semicolons/brackets –> mainly identation
interpreted NOT compiled (translate on the fly)
Difference Interactive mode versus Python scripts
Interactive mode = “console”, won’t save
Python script saves code, end in .py, can be run from IDLE with run button
IDLE
Integrated Development Program
Single program that provides tools to write, execute and test a program
Has interactive and scripting mode
Function
prewritten code that performs a “blackbox” operation (e.g. print, max etc.)
Group of statements that exist within in a larger program
Argument
any data that is passed to a function, e.g. “Hello again”
Default type for input
Str
Variable
letter or word(s) that represents data stored in
the computer’s memory.
//
Floor division, divides two numbers and then returns the lower integer
Example
7//2 = 3
(7 divided by 2 is 3.5, and then rounded down)
%
Modulo - retains remainder
For example
7 % 2 = 1
(because 7 divided by 2 is 3 with a remainder of 1)
format function
.2f –> print(f” {number.2f}”)
,.2f –> comma and two decimal places
.0% –> percentage rather than decimal
,d –> adds commas for whole integers
end and sep arguments. Give an example
print(number sep=”___”)
print(number end=”___”)
\n = new line
\t = insert tab
Decision Structure
execute certain statements
only under certain circumstances.