You've Been Reassigned
Great work. You now know how to declare variables in Python and set them to different values, and you've learned about three different types of values: integers, floats, and booleans.
You can reassign a variable at any point. If you first set my_int
to 7
but later want to change it to 3
, all you have to do is tell Python my_int = 3
, and it'll change the value of my_int
for you.
Try it and see!
# my_int is set to 7 below. What do you think
# will happen if we reset it to 3 and print the result?
my_int = 7
# Change the value of my_int to 3 on line 8!
my_int =3
# Here's some code that will print my_int to the console:
# The print keyword will be covered in detail soon!
print my_int