ThinkPython Basic Flashcards

Refresh my Python knowledge

1
Q

Operator

A

Special symbols that represent computations like addition and multiplication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Division

A

/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Multiplication

A

*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Exponentiation (raises number to a power)

A

**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Types of values

A

integer
floating point number
string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Interpreter

A

A program that reads another program and executes it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Integer

A

Type that represents whole numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

floating-point

A

Type that represents numbers with fractional parts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

String

A

Type that represents a sequence of characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Variable

A

A name that refers to a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Assignment statement

A

Creates a new variable and gives it a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

State diagram

A

A way to represent variables on paper by drawing an arrow from a variable to its value. It shows the state of each variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Keyword

A

Used by the interpreter to recognize the structure of the program, they cannot be used as variable names.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Expression

A

A combination of values, variables, and operators.

*Values and variables are considered expressions by themselves.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Evaluate

A

The interpreter does this to find the value of an expression given in the prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Statement

A

A unit of code that has an effect, like creating a variable or displaying a value.

17
Q

Execute

A

The interpreter does what the statement says.

18
Q

Script

A
  1. A program stored in a file.
  2. A file of saved code that can be run by the interpreter.
    * Running in interactive mode is useful for testing bits of code before putting them into a script.
19
Q

Order of operations

A

PEMDAS
The order of evaluation. Parentheses, Exponentiation, multiplication, division, addition, subtraction

*Operators with the same precedence are evaluated from left to right, except exponentiation.

20
Q

String concatenation

A

Join strings by linking them end-to-end, using the + operator. To perform repetition, use *. If one of the values is a string, must use an integer.

*Performing mathematical operations on strings is illegal.

21
Q

Comments in Python

A
# A single line
""" An entire chunk
22
Q

Operand

A

One of the values on which an operator operates.