← back to unit
Easy
# basics variables
Reassigning a Variable
A variable can be given a new value later — this is called reassigning it. The old value is simply forgotten:
mood = "sleepy"
print(mood)
mood = "excited"
print(mood)
This prints:
sleepy
excited
Your turn: read a word from input, store it in a variable called mood, and print it. Then reassign mood to the word thrilled and print it again.
💡 need a hint?
pyb-var-create-reassign.py
loading...