CH2 combined REVIEW

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Computer programs typically perform what three steps?

Receive input, process input, create output

Data Types

The categories of values in memory. Ex. int, float,...

float

The classification of a real number data type. Ex. Real Numbers 1,2.4,.333333333333...etc.

str

The classification of a string data type.

int

The classification of an integer data type. Ex. Integers 1,2,3,4,5,6,7...

Math Operators

The computers tools for preforming mathematical calculations. Ex. +,-, *,**, ...etc.

Assignment Operator

The equal sign ("=") in python is frequently called the _____ because it gives a variable its value.

Argument

The information inside parenthesis. (working on this definition)(The data being acted upon by a function... I think)

Customer

The person, group, or organization that is asking you to write the program.

Call

To execute a function. Ex. "To ____ on a function is to execute it".

T or F: In Python the first character of a variable name cannot be a number.

True

T or F: In a math expression, multiplication and division takes place before addition and subtraction.

True

Reference

When a variable represents a value in the computer's memory it is said to ____ the value.

A(n) __________ is a set of well-defined logical steps that must be taken to perform a task.

algorithm

A(n) __________ makes a variable reference a value in the computer's memory.

assignment statement

Short notes placed in different parts of a program explaining how those parts of the program work are called __________.

comments

A string literal in Python must be enclosed in ____.

either single-quotes or double-quotes

Suppose the following statement is in a program: price = 99.0. After this statement executes, the price variable will reference a value of this data type.

float

If a math expression adds a float to an int, what will the data type of the result be?

float data type

This built-in function can be used to convert an int value to a float.

float()

A __________ is a diagram that graphically depicts the steps that take place in a program.

flowchart

This built-in function can be used to read input that has been typed on the key- board.

input()

A ___error does not prevent the program from running, but causes it to produce incorrect results.

logic

In the expression 12 + 7, the values on the right and left of the + symbol are called __________.

operands

An informal language that has no syntax rules, and is not meant to be compiled or executed is called __________.

pseudocode

A __________ is a single function that the program must perform in order to satisfy the customer.

software requirement

A __________ is a sequence of characters.

string

A __________ is any hypothetical person using a program and providing input for it.

user

A __________ is a name that references a value in the computer's memory.

variable

Which of the following statements will cause an error? a. x = 17 b. 17 = x c. x = 99999 d. x = '17'

B. 17 = x

Program Development Cycle

Design the program--> Write the code--> Correct Syntax Errors--> Test the program--> Correct logic errors

T or F: If you print a variable that has not been assigned a value, the number 0 will be displayed.

False

T or F: Variable names can have spaces in them.

False

T or F: Programmers must be careful not to make syntax errors when writing pseudocode programs.

False

What does a professional programmer usually do first to gain an understanding of a problem?

First focus is on the software requirement.

What is the difference between floating-point division and integer division?

Floating point division includes a decimal. Integer division does not include decimals.

What is pseudocode?

It's an informal description of an algorithm written in a top-down approach.

Nested Function

A ____ takes the output of one inside function and uses it as the input of another outside function.

Newline Character

A character which normally appears at the end of every line of code that causes the output to advance to the next line.

End-line Comment

A comment that appears at the end of a line of code (usually to explain the statement that appears in that line) Ex. 1 print("Christopher Cummin") #Display the name.

Flowchart

A diagram that graphically depicts the steps that take place in a program.

Variable

A name that represents a value in the computers memory. Ex. >>> width = 10 "width" is the example of the term

Numeric Literal

A number that is written into a program's code.

Function

A piece of code that preforms a predefined operation. Ex. "print"--> print ('Hello world') The print ____.

Garbage Collection

A process in which the Python interpreter automatically removes a variable from memory when it is no longer referenced.

String

A sequence of characters that is used as data.

Algorithm

A set of well-defined steps that must be taken to preform a task.

Software Requirement

A single task that a program must preform in order to satisfy the customer

Escape Character

A special character appearing inside a string literal which, when printed, is treated as a special command embedded in the string.

Math Expression

A statement that performs a calculation. Ex. >>> 12 +2

Assignment Statement

A statement which creates and gives value to a variable. Ex. >>> age = 25 or the generalized version >>> variable = expression

String Literal

A string that appears in the actual code of a program.

Format Specifier

A string that contains special characters specifying how the numeric value should be formatted Ex. >>> format (12345.6789), '.2f') (the '.2f' stands for round to two decimal places)

Expression

A value, or any piece of code that results in a value. (usually assigned to a variable in an Assignment Statement) (Examples of values include True, False, 1, 500, "Hello World"...etc.) Ex. >>> variable = expression

This symbol marks the beginning of a comment in Python.

#

This operator performs division, but instead of returning the quotient it returns the remainder.

%

Pseudocode

(Fake code) An informal language with no syntax errors used create models of programs.

This is an operator that raises a number to a power.

**

Variable Naming Rules

*0* Cannot use one of pythons key words as a variable name *0* A variable name cannot contain spaces. *0* The first character must be one of the letters a through z, A through Z, or an under score character (_). *0* After the first character you may use the letters a through z or A through Z, the digits *0* through 9, or underscores. *0* Uppercase and lowercase characters are distinct. This means the variable name I*temsOrdered* is not the same as *itemsordered*.

Python Math Operators

+ Addition - Subtraction * Multiplication / Division // Integer Division % Remainder ** Exponent

This operator performs integer division.

//


Ensembles d'études connexes

Research Methods External Validity

View Set

Understanding Business Chapter 13

View Set

International Marketing Chapter 11

View Set

Thrombophlebitis, DVT and Embolus (final)

View Set

How did the Cold War develop in the years 1949-1955? C) The Arms Race 1949 - 1955 and Peaceful Co-existence

View Set

MARKETING 2 CHAPTER 12 SERVICES: THE INTANGIBLE PRODUCT

View Set