Changing a Value
Update what a variable remembers.
Change the Box! 🔄
Here is something cool: you can change what is inside a box anytime!
Take the old thing out, put a new thing in. Like swapping toys! 🧸
box = "apple"
box = "banana"
print(box)Out With the Old 📤
When you put something new in a box, the old thing leaves!
The box only keeps the newest thing. Bye-bye old value! 👋
snack = "chips"
snack = "cookies"
print(snack)All lessons in this course
- What Is a Variable?
- Naming Your Variables
- Changing a Value
- Using Variables Together