Mark As Completed Discussion

Reassigning variables

Values can be reassigned to variables in Python. When variables are reassigned, their value changes to that of the newer value specified, and the previous value is lost.

Reassignment of Variables

Let's look at an example. We can reassign variable values in Python as follows.

1var a = 10;
2a = 34;

The reassignment works similarly to how we create the variable. We only provide a different value than what was stored before. Here, the initial value of a was 10, which was reassigned to 20 from the second line in the above code block.