Unit 2.2:Variables Flashcards

(3 cards)

1
Q

What is a variable?

A
  • Variables are containers in memory that store data.
  • Each variable has a unique name (identifier) that refers to its stored value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is declaration and initiation?

A
  • Variables must be declared (created) and often initialized (given an initial value) before they can be used.
  • The assignment operator (=) is used to assign a value to a variable.
  • Attempting to use an undeclared or uninitialized variable will result in an error.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a constant?

A
  • Constants are variables whose values are intended to remain unchanged throughout the program.
  • While Python doesn’t enforce constants, the convention is to write their names in ALL CAPS to signal their intended immutability.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly