Fundamentals: Program Vocab Flashcards

1
Q

Expression

A

A unit of code that can be evaluated into one value.
Used in a sentence:
“The expression 999 > 0 is True!” “We use the expression 999 > 0 to determine if our code prints “Hello!”,” “While I’m debugging, I need to keep checking what the expression total_price * 1.1 evaluates into”

In programming, an expression is a unit of code that can be evaluated into one value.

We use expressions mainly to get a value.

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

Statement

A

A unit of code that is used to execute a change

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

Variable

A

A name that is a reference to a specific place in memory, and the value stored there. Variables can be assigned and reassigned values.

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

Literal

A

A value that is the value itself.

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

Integer

A

Represents an integer! A whole number that is positive, negative, or zero.

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

Float

A

Represents a number that isn’t whole; it is fractional, or has a decimal place.

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

String

A

Represents text, specifically with an ordered sequence of characters.

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

Boolean

A

Represents true or false.

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

List

A

An ordered list of values. Items in the list are sometimes called elements. Can get the value of an item by using square brackets and the index of the item.

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

Dictionary

A

An unordered collection of key-value pairs. Can access values in the dictionary by using square brackets and the name of the key.

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

Range

A

A sequence of numbers between a start, stop, and incrementing by a step.

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

Tuple

A

An ordered, unchangeable collection of items.

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

Set, frozenset

A

An unordered collection. Cannot access values with index or key; must use a loop.

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

bytes, bytearray

A

A collection of binary digits (bits).

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

Get the Data Type with type()

A

If we’re ever unsure about what the data type of a value is, we can use Python’s built-in method type() to read the data type.

print(type(“This is a string!”))
print(type(6789 * 100))
print(type(3.3))
print(type([“do”, “re”, “mi”]))

my_bicycle_details = {
    "frame_color": "red",
    "num_of_wheels": 2,
    "grip_tape_color": "turquoise"
}
print(type(my_bicycle_details))
print(type(my_bicycle_details["num_of_wheels"]))

PRINTS OUT:

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

Casting

A

We can convert a value to a different data type.
We can use these methods to convert a value into another data type
int()
float()
str()
bool()