• Save
  • Download
  • Clear Output
  • Runtime
  • Run All Cells

Loading Runtime

Before you start

Before starting these exercises make sure you watch the following lessons:

How to check your code:

When you're done writing your code make sure you hit the "play button" on the left-hand side to execute the code. Once the code has been executed, you can test your solution to see if it's correct by hitting the "submit" button on the right-hand side of the code cell.

Exercise 1 - Create an age variable

Create a variable called age and assign it the value of your age in years as an integer.

You don't have to put your actual age if you don't want to, but the value you store to this variable should be:

  • An integer
  • Greater than 0
  • Less than 120
Fun Fact:The person with the oldest verifiable age was Jeanne Calment who lived to be 122 years and 164 days old.

Exercise 2 - Create a height_cm variable

Create a variable called height_cm and assign it the value of your age in years as an integer.

You don't have to put your actual height if you don't want to, but the value you store to this variable should be:

  • An integer
  • Greater than 0
  • Less than 228

Exercise 3 - Create a weight_kg variable

Create a variable called weight_kg and assign it the value of your weight rounded to the nearest whole kilogram.

You don't have to put your actual weight if you don't want to, but the value you store to this variable should be:

  • An integer
  • Greater than 0
  • Less than 651
Fun Fact:Jon Brower Minnoch was the heaviest person ever recorded reaching a weight of 650 kilograms.

Exercise 4 - Create a number_of_pets variable

Create a variable called number_of_pets and assign it the the number of pets owned in your household.

The value you store to this variable should be:

  • An integer
  • 0 or greater.
  • Less than 5000. (Sorry if you actually own 5000 or more pets).

Exercise 5 - Create a number_of_cars variable

Create a variable called number_of_cars and assign it the value of however many cars are owned by your household.

The value you store to this variable should be:

  • An integer
  • 0 or greater.
  • Less than 5000. (Sorry if you actually own more than 5000 cars)
Fun Fact:The largest private car collection is owned by Sultan of Brunei –Hassanal Bolkiah. His collection boasts over 5000 cars and has an estimated value of more than five billion dollars.

Exercise 6 - create a power_level variable

Declare a variable called power_level and assign it the value of 9001.

What did you say his power level is?? –It's over 9000!

Exercise 7 - create a hardy_ramanujan variable

Declare a variable called hardy_ramanujan and assign it the value of 1729.

When you're done writing your code make sure you hit the "play button" on the left-hand side to execute the code. Once the code has been executed, you can test your solution to see if it's correct by hitting the "submit" button on the right-hand side.

Exercise 8 - create an annual_salary variable

Declare a variable called annual_salary and assign it the value of 90000.

Fun Fact:According to Indeed.com the average salary for a Data Scientist in the United States is $124,300

Exercise 9 - reassign the annual_salary variable a new value

Congrats! You got a raise! Re-assign the value of annual_salary a new value of 95000.

You can explicitly re-assign the value of a variable at any time in Python. Doing this will overwrite the previous value that was stored to the variable.

Take Note:You can explicitly re-assign the value of a variable at any time in Python. Doing this will overwrite the previous value that was stored to the variable.