Lesson 1 - Intro to Python

This lesson will lead you through the basics of Python syntax and hotkeys for Jupyter.

Declaring and Assigning values

Type print("Hello World") and press <Shift + Enter>

Values are a form of representation or description.

For example, a person's name is

The number of days I have to go school is

Commenting is a form of notation. Python ignores everything after the hashtag #


Numbers are categorised into 2 types

Find out which type they are by using the function type()


Strings refer to texts and are defined with quotation marks " ".

Is "6" a string or an integer? Find out with type() function!


Find out whether the following are integers, floats or string

  1. 3.1415
  2. 9
  3. "12309"
  4. "Hi, what is your name?"
  5. 3 + 19


Variables are storage for your values. Imagine having a box and putting an apple inside.

Now try accessing the box to see what is inside by typing box and pressing <Shift + Enter>

What happens if you accessed a random_box?

Can you figure out why?

Rules for variable names

Try creating some variables that stores value!

Do these variable names work? Try them out!

Exercise 1

Store the following numbers in variables and obtain the total

total = ?

You realised you made a mistake in the third number. It was supposed to be 85 instead of 23. Find the new total.

After finding the new total, you wanted to compare what was the difference between the wrong answer.

Put on your thinking Cap

  1. Why is there a need to use variables?

  2. Why not type out the answers directly?

Type your answers in comments #

Converters / Casting

Sometimes you want to add numbers instead of string. For example

Did the above give you the correct answer? What can you do to get the correct answer?

Hint Try using the functions int(), float(), str()

Exercise 2

You are given the following variables. You want to see the difference between the + function in string and in int/floats.
Fix the variable names before finding the answer.