Intro to Python 3.8

Python Basics

Numbers, Lists and Sets


In order to comment a value in Python. Use the # as below.

# Trish Gatsi

For multi-line comments, use three double quotes, write your comments and use three double quotes at the end as below.

“ “ “

Brown Skin Girl
Glow Like Diamonds
Nappy curls

“ “ “







To store values in our program, we use variables. To do this,

a = “ Brow Skin Girl”

In python we can use double quotes or single quotes for strings. We can store multiple strings in a variable using a list as below:

b = [“ Brown skin girl” , “Glow like diamonds”]

To get an item out of  the list, you need to know its position in the list as below;

If we call b[0] – we get ‘ Brown skin girl’ as the output. If we call b[1], we get ‘Glow like diamonds’ as the output.

We can also add lists together. Python automatically resizes and they can store any data type you want. Python allows multiple data types in a single list as below,

b + [1,2,3,4,5]  the output will be  ‘b,1,2,3,4,5’


To create a set, we use curly brackets as below

c = {1,2,3,4,5,6,}

If we repeat numbers as we create a list as below,

c = {1,2,2,3,3,4,5,}

The output will be  ‘1,2,3,4,5’


We can also add logic in python that is making sure that certain things only happen when certain conditions are met using if statements,

     if 1 = = 1:
print (“yes”)

We can also use not equal to, greater than or equal to and less than or equal to.

Python also has Boolean data types that is True or False. We can also  use bolean operations that is 

True or False, we get True
True and False we get False

This is the basis of logic gates.