Python for Everyone, ch 1-5

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

semantic error

An error in a program that makes it do something other than what the programmer intended.

bug

An error in a program.

boolean expression (T/F)

An expression whose value is either True or False.

print statement

An instruction that causes the Python interpreter to display a value on the screen.

% modulus operator

An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.

#comment

Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.

branch

One of the alternative sequences of statements in a conditional statement.

value

One of the basic units of data, like a number or string, that a program manipulates. (on the right side of the statement)

logical operator (and, or, not)

One of the operators that combines boolean expressions: and, or, and not.

comparison operator

One of the operators that compares its operands: ==, !=, >, <, >=, and <=.

operand

One of the values on which an operator operates.

secondary memory

Stores programs and data and retains its information even when the power is turned off. Generally slower than main memory. Examples of secondary memory include disk drives and flash memory in USB sticks.

main memory

Stores programs and data. Main memory loses its information when the power is turned off.

condition

The boolean expression in a conditional statement that determines which branch is executed.

central processing unit

The heart of any computer. It is what runs the software that we write; also called "CPU" or "the processor".

machine code

The lowest-level language for software, which is the language that is directly executed by the central processing unit (CPU).

semantics

The meaning of a program.

5/2 = 2, floor division

The operation that divides two numbers and chops off the fractional part.

problem solving

The process of formulating a problem, finding a solution, and expressing the solution.

body

The sequence of statements within a compound statement.

rules of precedence

The set of rules governing the order in which expressions involving multiple operators and operands are evaluated. PEMDAS ex/ cost = meal + meal * tax

parse

To examine a program and analyze the syntactic structure.

interpret

To execute a program in a high-level language by translating it one line at a time.

concatenate

To join two operands end to end.

evaluate

To simplify an expression by performing the operations in order to yield a single value.

compile

To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution.

short circuit

When Python is part-way through evaluating a logical expression and stops the evaluation because Python knows the final value for the expression without needing to evaluate the rest of the expression.

prompt

When a program displays a message and pauses for the user to type some input to the program.

guardian pattern

Where we construct a logical expression with additional comparisons to take advantage of the short-circuit behavior. ex/ y != 0

traceback

A list of the functions that are executing, printed when an exception occurs.

mnemonic

A memory aid. We often give variables mnemonic names to help us remember what is stored in the variable. ex/ hours instead of njddbf3

variable

A name that refers to a value. (on the left side of statement)

source code

A program in a high-level language.

high-level language

A programming language like Python that is designed to be easy for humans to read and write.

low-level language

A programming language that is designed to be easy for a computer to execute; also called "machine code" or "assembly language".

portability

A property of a program that can run on more than one kind of computer.

keyword

A reserved word that is used by the compiler to parse a program; you cannot use keywords like if, def, and while as variable names. (print, elif, etc)

statement

A section of code that represents a command or action. So far, the statements we have seen are assignments and print statements.

program

A set of instructions that specifies a computation.

operator

A special symbol that represents a simple computation like addition, multiplication, or string concatenation. (+, -, ...)

= assignment

A statement that assigns a value to a variable.

compound statement

A statement that consists of a header and a body. The header ends with a colon (:). The body is indented relative to the header.

conditional statement

A statement that controls the flow of execution depending on some condition.

float(), 1.0, floating point

A type that represents numbers with fractional parts.

string

A type that represents sequences of characters.

1, integer

A type that represents whole numbers.

interactive mode

A way of using the Python interpreter by typing commands and expressions at the prompt.

type

A category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str).

expression

A combination of variables, operators, and values that represents a single result value.

nested conditional

A conditional statement that appears in one of the branches of another conditional statement.

chained conditional

A conditional statement with a series of alternative branches. (alternative sequences)


Set pelajaran terkait

Principles of Management Test 3 [Ch.5+6] - Loes

View Set

Chapter 11, Chapter 12, Chapter 13

View Set

macroeconomics chapter 7 - exam 3

View Set

Cycle 2 Global 10 Study Guide Voight

View Set