Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The print function
Math in Python
12. Adding and subtracting numbers
The input function


Great! Python knows math quite well, too. For instance, it can add (+) or subtract numbers (-):

temp_yesterday = 30
temp_today = 35
temp_difference = temp_today - temp_yesterday

The code above will print 5, which is the difference between temp_today and temp_yesterday.


Declare two variables:

  • population_a with a value of 10000,
  • population_b with a value of 5000.

Then, create a variable named total_population that will add the values of population_a and population_b. Finally, print the value of total_population.

Stuck? Here's a hint!

Compute the total_population in the following way:

total_population = population_a + population_b