Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The print function
9. Assigning new values to variables
Math in Python
The input function


Great! You can change the values of variables at any moment. Take a look:

current_age = 25
current_age = 26

The code above will print 25 and then 26. If you want a new value for your variable, simply use the equals operator (=) again.


  • Create a variable named mood with a string value: I feel good today.
  • Print the value of mood.
  • Assign a new value to mood: I feel bad today.
  • Print the mood variable again.

Stuck? Here's a hint!

You will need four lines of code. Remember that string values must be surrounded with either single or double quotation marks:

mood = 'I feel good today'