Join for Free:

# PYTHON FUNDAMENTALS

Session 1: Introduction to Python

We will begin this session with a journey back in time where we find out how and why Python was created. We will start coding Python using the Interactive Shell, a mode of programming that lets us write and test one line of code at a time and work our way into writing some interesting programs (see below) that are incredibly simple and really illustrate why Python is so incredibly popular in the tech world.

ACTIVITIES:

Nickname creation program (concepts: variables, user input, string concatenation)

Future age calculator program ( concepts: variable conversion, user input)

Times table creator program (concepts: mathematical operators, looops)

Session 2: Chat-bots

If -elif – else statements are also collectively called control statements and they essentially enable a computer program to make a decision based on a computation or a user input. We will use this decision making mechanism to create chatbot programs that imitate natural human conversations. We will start with yes or no questions and build towards more sophisticated responses which check if a particular word is in a user response. By the end of the sessions we will we be trying to give our chatbot some personality: opinions on sports teams, celebrities and humans in general. What kind of a bot will you create?

ACTIVITIES:

Yes / No question with appropriate responses (concepts: if statements, boolean operators)

Multiple choice choice questions with appropriate responses ( concepts: if elif else statements)

Smart input recognition (concepts: membership statements, case conversion)

Session 3: Programming shapes with Python

So far every program we wrote either dealt with text or numbers. In this session we are going to write programs that create shapes using the turtle library in which the program moves a turtle on screen leaving behind a trace. We are going to start off by using loops to repeat patterns of moving and turning which draw squares. We will learn how to combine this with variables create a function that can draw any polygon: triangle, square, pentagon, octagon

ACTIVITIES:

Drawing a square with a for loop (concepts: for loops, turtle forward, right and left functions )

Using pen related functions to draw mulptiple shapes (concepts: turtle penup and pendown functions)

Creating a polygon function (concepts: python functions with parameters )

Python Fundamentals Curriculum

Session 4: Drawing Trees, Shells and Fractals

Every day video games and animated movies move closer to resembling reality, this is made possible in great part though our understanding of fractals which are self similar patterns that occur everywhere in nature: shells, clouds, plantlife, river systems etc . . . Fortunately for us we can create a great variety of spectacular fractal shapes using only turtle and a process called recursion where functions that draw shapes call on themselves

ACTIVITIES:

Drawing and fractal polygons (concepts: recursion, fractals)

Drawing a Sierpinski triangle (concepts: self similar shapes, recursion stops)

Drawing realistic trees (concepts: randomised recursive patterns)

Session 5: Primes Factors and Functions

The quest to find ever more prime numbers and the patterns by which they are associated dates back to the Ancient Greece. In fact 3000 years after the famous Sieve of Eratosthenes cryptographers and computer scientists are using prime numbers for encryption to encrypt messages and are still looking for ever larger primes. In this session we will begin with an algorithm for factorisation which has a capacity to discover primes (which are just numbers with 2 factors) Eventually we will build a brute force algorithm that discovers primes and gain some insights into algorithm efficiency

ACTIVITIES:

Factorisation algorithm (concepts: mathematical operators, loops)

Prime testing algorithm (concepts: booleans, mathematical operators)

Finding all primes under 10,000 (concepts: nested loops, break statements, lists)

Session 6: Emotion sensing chatbot with A.I.

As you are reading this millions of people are somewhere in the world are interacting with chatbots usually on a phone call or a shopping website. These chatbots are rapidly becoming less annoying, more helpful and even more human like in how they interact with us. Much of this is made possible by something called Sentiment Analysis which enables computer programs to understand human emotions, making them seem genuinely intelligent. In this session we are going to endow our chatbots with an ability to interpret emotions and become more empathetic and human like!

Sentiment polarity program (concepts: sentiment polarity, TextBlob library)

Sentiment subjectivity program (concepts: sentiment subjectivity, TextBlob library)

Graduated response program (concepts: sentiment polarity and subjectivity, if elif else statements, lists TextBlob library)