When a new value is stored in a variable, its previous value gets ______________
Answers
Answered by
24
Answer:
Explanation:
The variable is used to hold some value that can be used by the program. when any variable holds some value and the user will change the value from a new value, then that variable will holds the new value and the old value will erase or changed to a new value.
Answered by
0
Answer:
When a new value is stored in a variable then its previous value gets overwritten.
Explanation:
- A variable is basically a container which represents a memory location.
- When we declare a variable some bytes are reserved for storing the value of the variable.
- When we assign a variable a value the data is stored at some memory locations.
- A combination of 0s and 1s are written to those locations.
- And when we reassign the variables with different values, the combination of 0’s and 1’s changes.
- If we replace the contents, then the content is lost.
- It overwrites the previous value in memory at that location.
For example:-
a = 10
print(a)
This will give us output: 10
____________________
a = 10
a = 12
print(a)
This will give us output: 12
Hence, the previous data is lost.
Note: Python programming language is used in above examples.
Similar questions