Skip to content

Roadmap to Learning Python

Dan Mossor edited this page Sep 10, 2018 · 2 revisions

Below is a long read, but it assumes you know nothing - skip as you need to.

Disclaimer 1:

This educational exploration into Python is NOT designed to be your very first introduction into coding. Don’t worry - it’s still very beginner material (and we progress onto intermediate topics), but there is work you will need to complete BEFORE watching the first video.

Disclaimer 2:

This will get difficult, fast. Do not be alarmed. I’m jumping across skill levels between videos, but the idea is I’m here to answer any questions you may have. Also, I always choose a project that’s extensible - meaning you can expand upon what we’ve done as practice!

Disclaimer 3:

I’m not perfect. It is likely that you may be able to improve upon the code that I write. Feel free to do so and share!

How do I install Python?

Windows 10

  • Install the Windows Management Framework
    NOTE: You need to install the whole thing to gain access to PowerShell. Whenever I say CLI, this is what I am referring to for Windows users.
  • Follow the instructions in this video, ignoring everything about atom.io.

MacOS

  • Make sure you have Xcode installed! If you don’t, get it - it’s free.
  • Get Homebrew - it's free, too.
  • Open a new terminal after install
  • Type and enter: brew install python
  • Type and enter: brew install python3

Linux

  • Common, modern Linux distros will likely already have Python 2 and 3 installed by default.
  • You can check this by running the following commands in your terminal:
    • $ python --version should yield Python 2.7.13
    • $ python3 --version should yield something like Python 3.6.x
  • If you didn’t see the expected feedback, your situation may be remedied by running:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade
    • $ sudo apt install python[3]
      NOTE: Replace with your distribution's package manager, such as <yum, dnf, zypper, pacman...> and so on.

Regardless of your operating system, you can confirm installation of Python 3.6.x by typing and entering python3 -V and python -V in your CLI (Command Line Interface).

You should see Python 3.6.# and Python 2.7.13 respectively.

Your platform is ready to handle Python locally (on your own computer)! Wooo!

Now go to CS Circles from University of Waterloo, and complete their Python course. It may take you a good chunk of time to complete it, but it’s how I learned Python - it’s simple, it makes sense, and you don’t need to install anything except a browser (and you probably already have that). If you’d like an alternative to CS Circles, you can try http://learnpython.org/!

When you’re done with CS Circles, I recommend that you download VS Code (Windows), Sublime Text (Mac), or Atom (Any OS) and - depending on your operating system - Google "run python in terminal " and see how you can run a program that you write! This is a more interesting and dynamic topic that a simple write-up can’t handle, so feel free to ask the Python channel on our Slack team for help.

TL;DR

  • Install Python
  • Learn Python syntax with CS Circles or LearnPython.org
  • Download and Install a code editor
  • Learn how to run Python programs with your command line interface

Done? NOW, we’re ready to go…


Week One

Lesson (links to video)

Pre-workout:

CS Circles

Content

  • High-level overview of Python
  • Code-along: Rock, Paper, Scissors
  • Practice: Create other command line games!

Week Two

Lesson (links to video)

Pre-workout

Content

  • A deeper glance into Python’s internals
  • Object-Oriented Programming
  • Software Engineering Design Patterns
  • Practice: Expand upon the strategy pattern!

Week Three

Lesson (links to video)

Pre-workout

Khan Academy

Content:

Space- and Time-Complexity in Code Code-along: Actual Interview Question!

Practice:

HackerRank.com CodeWars.com CodeFights.com LeetCode.com

Warning: Very scary math stuffs!

Khan Academy is doing the best they can to make the language simple. There’s a lot of jargon going into it, but please at least skim it and then ask questions.

My 2 Cents

I’ve said before that code is only good if it’s readable, fast, and small. Readability is subjective and it has been discussed it at length, but there’s actually a science behind determining how quick and lightweight your code is. The concept of measuring the size of your code is called “Space-Complexity” and the concept of measuring its speed is called “Time-Complexity”.

Big-O means “at least” Big-Theta means “on average” Big-Omega means “at most”

Usually, we measure both time- and space-complexity with regards to the worst-case scenario. For example, if we have a function that simply iterates through a for loop of a list, we would say the the solution runs in O(n) time. In other words, a for loop takes at least n computation-times to complete (n being the size of the list).

It is a little more complex, but consider every for loop or while loop to be n in size. If we have a loop within a loop, were doing n operations n times so the code would be O(n^2) time. If we were able to solve a problem without a loop, it’d likely be O(1) aka “Constant time” - this is the best case scenario in time- and space-complexity. If we were able to solve a problem with just one loop, it’d likely be O(n) aka “Linear Time” - this is widely regarded as a good solution. Other common complexities are O(nlogn) and O(logn) - http://bigocheatsheet.com/