Chapter 1 : ZyBooks Python Vocab

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

program

A computer program consists of instructions executing one at a time.

newline

A line break, known as a newline, is output after every print() statement.

line

A line is a row of text.

bug

A logic error is often called a bug.

assignment statement

An assignment statement assigns a variable with a value, such as x = 5.

identifier / name / underscores

An identifier, also called a name, is a sequence of letters (a-z, A-Z), underscores (_), and digits (0-9), and must start with a letter or an underscore.

interactive interpreter

An interactive interpreter is a program that allows the user to execute one line of code at a time.

object

An object represents a value and is automatically created by the interpreter when executing a line of code. For example, executing x = 4 creates a new object to represent the value 4.

whitespace

Any space, tab, or newline is called whitespace.

comments

Characters such as "#" denote comments, which are optional but can be used to explain portions of code to a human reader.

Code

Code is a common word for the textual representation of a program (and hence programming is also called coding).

garbage collection

Deleting unused objects is an automatic process called garbage collection that frees memory space.

Expressions

Expressions are code that return a value when evaluated; for example, the code wage * hours * weeks is an expression that computes a number.

Identity

Identity: A unique identifier that describes the object.

int()

If a string contains only numbers, like '123', then the int() function can be used to convert that string to the integer 123.

variable

In a program, a variable is a named item, such as x or num_people, that holds a value.

computational thinking

In the information age, many people believe computational thinking, or creating a sequence of instructions to solve a problem, will become increasingly important for work and everyday life.

incrementing

Increasing a variable's value by 1, as in x = x + 1, is common and known as incrementing the variable.

Input

Input: A program receives data from a file, keyboard, touchscreen, network, etc.

immutable

Integers and strings are immutable; meaning integer and string values cannot be changed.

Mutability

Mutability indicates whether the object's value is allowed to be changed.

Name binding

Name binding is the process of associating names with interpreter objects. An object can have more than one name bound to it, and every name is always bound to exactly one object. Name binding occurs whenever an assignment statement is executed, as demonstrated below.

syntax error

One kind of mistake, a syntax error, violates a programming language's rules on how symbols can be combined to create a program.

newline character

Output can be moved to the next line by printing "\n", known as a newline character.

Output

Output: A program puts that data somewhere, such as a file, screen, or network.

PEP 8

PEP 8 (Python Enhancement Proposal) outlines the basics of how to write Python code neatly and consistently.

print()

Print() function displays variables or expression values.

Process

Process: A program performs computations on that data, such as adding two values like x + y.

variables

Programs use variables to refer to data, like x.

case sensitive

Python is case sensitive, meaning uppercase and lowercase letters differ. Ex: "Cat" and "cat" are different.

id()

Python provides a built-in function id() that gives the value of an object's identity.

input()

Reading input is achieved using the input() function.

Reserved words / keywords

Reserved words, or keywords, are words that are part of the language and cannot be used as a programmer-defined name.

type

Strings and integers are each an example of a type; a type determines how a value can behave.

logic error

Such an error is known as a logic error, because the program is logically flawed.

string literal

Text enclosed in quotes is known as a string literal.

Python interpreter

The Python interpreter is a computer program that executes code written in the Python programming language.

type()

The built-in function type() returns the type of an object.

string

The input obtained by input() is any text that a user typed, including numbers, letters, or special characters such as # or @. Such text in a computer program is called a string.

prompt

The interactive interpreter displays a prompt (">>>") that indicates the interpreter is ready to accept code.

variables

The names wage, hours, weeks, and salary are variables, which are named references to values stored by the interpreter.

print()

The primary way to print output is to use the built-in function print().

runtime error

The program may have another kind of error called a runtime error, in which a program's syntax is correct but the program attempts an impossible operation, such as dividing by zero or multiplying strings together (like 'Hello' * 'ABC').

whitespace

Whitespace is any blank space or newline.

crash

Abrupt and unintended termination of a program is often called a crash of the program.

assignment

A new variable is created by performing an assignment using the = symbol.

algorithm

A sequence of instructions that solves a problem is called an algorithm.

statement

A statement is a program instruction.

Type

Type: The type of the object, such as integer or string.

Value

Value: A value such as "20", "abcdef", or "55".


Set pelajaran terkait

AP Psych Personality Test Review

View Set