CSCI Fall 2018 Midterm Flashcards
(94 cards)
conditional execution
instruction check for certain conditions, and run their accompanying code
repetition
instruction to perform some action repeatedly, usually with some variation
Python interpreter
program that reads and executes python code
> > >
prompt. telling you that interpreter is ready for you to enter code
*
multiply
**
62 = 36
33=27
exponent
ctrl + z
zombies the program. stops it in its track
kill %n
kills the nth job–use carefully
value
one of the basic things a program works with, like a letter or a number. Some
values we have seen so far are 2, 42.0, and ‘Hello, World!’.
type
integers, floating-point numbers, strings
type()
gives you what type of value is inside the parentheses
prompt
Characters displayed by the interpreter to indicate that it is ready to take input
from the user.
interpreter
A program that reads another program and executes it
program
A set of instructions that specifies a computation
Operator
A special symbol that represents a simple computation like addition, multiplication,
or string concatenation.
int
type
integer
whole number
float
type
numbers with fractional parts
string
sequence of charachters
syntax
rules that govern structure of program
assignment statement
creates a new variable and gives it a value:
»> message = ‘And now for something completely different’
»> n = 17
»> pi = 3.141592653589793
Python key words
False class finally is return None continue for lambda try True def from nonlocal while and del global not with as elif if or yield assert else import pass break except in raise
string concatenation
The + operator performs string concatenation, which means it joins the strings by linking them end-to-end. For example: >>> first = 'throat' >>> second = 'warbler' >>> first + second throatwarbler
syntax error
“Syntax” refers to the structure of a program and the rules about that structure.
For example, parentheses have to come in matching pairs, so (1 + 2) is legal,
but 8) is a syntax error.
semantic error
The third type of error is “semantic”, which means related to meaning.
If there is a semantic error in your program, it will run without generating error
messages, but it will not do the right thing. It will do something else. Specifically, it
will do what you told it to do.