Variables and Expressions Flashcards

1
Q

What is a variable?

A

a named item, such as x or num_people, that holds a value.

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

What is incrementation?

A

A statement that causes a variable’s value to increase.

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

What is an identifier?

A

The name of a variable.

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

What are the rules for identifers?

A

Cannot start with a number. Cannot contain special characters other than underscore. Cannot be a reserved word.

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

What is an object?

A

Any item in Python.

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

What is name binding?

A

The process of associating names with interpreter objects.

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

What is garbage collection?

A

The process of deleting unnecessary objects.

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

What are the properties of objects?

A

Value, Type and Identity.

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

What is id()?

A

A function that returns the memory address an object is stored at.

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

What is type()?

A

A function that returns the type of an object

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

Are strings mutable?

A

No.

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

Are integers mutable?

A

No.

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

What is Overflow?

A

An error that occurs when a value is too large to be stored in the memory allocated by the interpreter.

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

What are the minimum and maximum floating point values?

A

Min: 2.3 x 10^-308, Max: 1.8 x 10^308

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

How do you manipulate significant figures in Python?

A

Use print(f’{}’). Put variable:.xf inside the curly brackets with x indicating the desired decimal place.

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

What is an expression?

A

A combination of items that evaluates to a value.

17
Q

What is the order of precedence?

A

Parentheses, exponent, unary - (negative), multiplication = division = modulo, addition = subtraction, left-to-right.

18
Q

What are compound operators?

A

A method of incrementing a variable. Syntax is an arithmetic operator in front of an equals sign.

19
Q

What is floor division?

A

A form of division that rounds the quotient down to the nearest whole number.

20
Q

What is modulo?

A

A form of division that returns the remainder.

21
Q

How does Python distinguish between modules and scritps?

A

Scripts have the line “if __name__ == ‘__main__’”.

22
Q

How do you access objects from a model after it’s imported?

A

By using dot notation. module.variable.

23
Q

What is a function?

A

A list of statements that can be executed by referring to the function’s name.

24
Q

What is an argument?

A

An item that is passed to a function.

25
Q

What is randrange(x)?

A

A function that returns a random number from 0 to x -1.

26
Q

What is randint(x)?

A

A function that returns a random number from 0 to x.

27
Q

What is random.seed()?

A

A function that determines the initial value that all random functions draw from. By default, random functions draw from the system clock.

28
Q

What is Unicode?

A

A list of numbers that each represent one character.

29
Q

What is a code point in Unicode?

A

The term for the numbers in Unicode.

30
Q

What are Escape sequences?

A

A method of modifying a string from inside the string. They start with a backslash.

31
Q

What is a raw string.

A

A kind of string that ignores escape sequences. The syntax is r’text’.

32
Q

What is ord()?

A

A function that returns the encode integer value of a one character string.

33
Q
A