Python Data Type Exercises

Exercise 3-a

Let's check out a simple integer example.

You can simply assign a number to the variable men_stepped_on_the_moon by typing it on the left side of the equal sign and the number on the right side of it. 

Although this list didn’t include any woman so far, this might be about to change as Nasa announced there will certainly be a woman on its 2024 moon mission Artemis. The project is expected to cost $30 billion and you can read more about it here. )

Number on the right side doesn’t have to be in quotes.

men_stepped_on_the_moon = 12 

(this is the correct number but you can put any number for the purpose of this exercise. So far in our history only 12 men had the privilege to walk on the surface of the moon. 

Exercise 3-b

Now a string example.

As this is a string variable. Whatever you’d like to type will have to be inside quotes.

my_reason_for_coding = "Programming robots."

Exercise 3-c

Let's try to see what happens after assigning a new value to our variable. Note that program gets executed line by line.

Global mean sea level for year 2018 was 21.36 centimeters. 
This number was 0.1 centimeters in 1906. So we are seeing an increase of a 21.35 centimeter and rising. Quite a significant surge when you consider all the oceans and the seas on our planet.
If you’re interested has a very neat and detailed chart about it.

global_mean_sea_level_2018 = 21.36

Need More Exercises?

Check out Holy Python AI+ for amazing Python learning tools.

*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython