Zybooks L1 Flashcards

1
Q

A computer program consists of instructions executing at one time. Basic examples are:

A

Input (program receives data from a file, keyboard, network, etc)
process (program performs computations on data (i.e. x+y)
output (program puts that data somewhere (screen, file, etc)

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

computational thinking

A

creating a sequence of instructions to solve a problem (algorithm)

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

interpreter

A

A program that executes computer code.

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

code

A

The text that represents a computer program

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

prompt

A

Informs the programmer that the interpreter is ready to accept commands.

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

line

A

A row of text.

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

assignment

A

A new variable is created by performing an assignment using the = symbol, such as salary = wage * hours * weeks, which creates a new variable called salary.

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

expression

A

code that return a value when evaluated; for example, the code wage * hours * weeks is an expression that computes a number. The symbol * is used for multiplication. The names wage, hours, weeks, and salary are variables, which are named references to values stored by the interpreter.

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

what is the purpose of variables?

A

to store values for future use

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

how are most python programs developed

A

by writing codes in files

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

text

A

output from a Python program using the built-in function print( )

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

string

A

Text enclosed in quotes is known as a string. Text in strings may have letters, numbers, spaces, or symbols like @ or #.

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

keeping output in the same line

A

input
# Including end=’ ‘ keeps output on same line
print(‘Hello there.’, end=’ ‘)
print(‘My name is…’, end=’ ‘)
print(‘Carl?’)
output
Hello there. My name is… Carl?

Any character, or multiple characters, can be used instead of a space character.

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

command print variables and multiple values

A

The value of a variable can be printed out via: print(variable_name) (without quotes around the variable name). A single output line may include multiple strings and variables separated by commas. A space character is automatically added between each.

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

newline character “\n”

A

output can be moved to the next line using this
Ex: print(‘1\n2\n3’

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

escape sequence

A

string that has a special meaning, like the newline character “\n”, that always starts with a backslash “". Other escape sequences exist, such as “\t” to insert a tab, or “\” to print an actual backslash character.

Any space, tab, or newline is called whitespace.

17
Q

The input() function is used to read input from a user.

A

The statement best_friend = input() will read text entered by the user, and assign the result as a new string to the best_friend variable. The input() function causes the program to wait until the user has entered text and pushed the return key.

18
Q

int() function

A

using whole numbers

19
Q

Input prompt

A

Adding a string inside the parentheses of input() displays a prompt to the user before waiting for input and is a useful shortcut to adding an additional print statement line.
hourly_wage = int(input(‘Enter hourly wage: ‘))

20
Q

runtime error

A

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’)