Calculations with variables
You've now created a savings variable, so let's start saving!
Instead of calculating with the actual values, you can use variables instead.
How much money would you have saved four months from now, if you saved $10 each month?
This is a part of the course
“Introduction to Python”
Exercise instructions
- Create a variable
monthly_savings
, equal to10
andnum_months
, equal to4
. - Multiply
monthly_savings
bynum_months
and assign it tonew_savings
. - Print the value of
new_savings
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create the variables monthly_savings and num_months
# Multiply monthly_savings and num_months
new_savings = ____
# Print new_savings