05/05 - Practing Python Basics

python gif

Class Curriculum

Section content Expected time (mins) Pre - Requirements
Questions on Python Basics 15 minutes
Working on exercises with partner 45 minutes
Break 10 minutes
Working on exercises with partner 45 minutes
Check-out 5 minutes

1. Recap

→ Data Types we have learned about so far are Strings, Numbers, Booleans, Lists and Dictionaries

 1# Strings
 2"Hello World" # 'Hello World' (double or single quotation marks)
 3# Numbers
 41
 51.5
 6# Booleans
 7True
 8False
 9# Lists
10[1, 2, 3]
11['Hello', 'World']
12# Dictionaries
13{'name': 'John', 'age': 30}

→ we usually store data in variables through the use of the = operator (therefore called assignment operator)

1# Assign a value to a variable
2name = 'John'
3# Print the value of the variable
4print(name)
5# Print the type of the variable
6print(type(name))

→ If-else statements are used to control the flow of your code.

1if condition:
2  # do something
3elif condition:
4  # do something
5else:
6  # do something

→ with the help of the for loop we can for example iterate over a list.

1for item in list:
2  # do something

2. Goal for today

→ Get more comfortable with Python basics.

→ Learn how to google for certain methods and ideas.

3. Exercises

Go to this link to get todays exercises - clone the repository.

  1. Open the folder called "Exercises" and start working on the challenges in the strings.py file.
  2. Continue working on the challenges in the lists.py file.
  3. Move on to working on the challenges in the dictionaries.py file.