Variables - Answer Key

Authors

Noor Sohail

Will Gammerdiner

Published

June 1, 2026

Exercise 1

  1. Create two new variables called a, that has the value of 5, and b, that has the value of 3.
a = 5
b = 3
  1. Subtract b from a and assign it to the new variable called difference
difference = a - b
  1. Using the variables a, b and difference, print out the sentence that looks like:
The difference of 5 and 3 is 2
print("The difference of", a, "and", b, "is", difference)
The difference of 5 and 3 is 2

Exercise 2

  1. How would you determine the data type on your_number and what data type is it?
type(your_number)
float

Reuse

CC-BY-4.0