Sage-Code Laboratory

Python Tutorial

Python is a high-level dynamic computer language. At this time is the most popular programming language according to Tiobe-index . Python was written by Guido van Rossum as a system scripting language. Many universities are using Python to teach programming concepts of Computer Science.

Video Lecture

Next video lecture is 2h long. It was recorded on Twitch in 2022. If you do not have the bandwidth for videos, or if you already know basic Python you can skip it. But if you watch it, you can post a comment and click the like button. This will help others interested in programming to find it and learn about us.

Python Tutorial

Course Scope

This tutorial is for very beginners. It is a fast pace essential tutorial based on simplified English. We have presented the language features in logical order with short examples and notes. You should scroll down and read without pause or interruptions until you finish each page. At the end of every page you should take a break. One page/day will enable you to finish the course in about 8 days. We recommend to learn 4 days/week so in two weeks you will become a Python developer.

Curriculum

This tutorial is organized like a book. At the end of each page there is a link for the next page. Every page has a index link on top right corner, that will bring you back here. If you wish to go back to a previous chapter, use the browser back button or the index below. If you are first time here, skip the index and read on. You will use the index later.

Index:

  1. syntax
  2. variables
  3. control flow
  4. functions
  5. classes
  6. generators
  7. closures
  8. packages

Python Issues:

Python is a great language if you use it for the right project. It is a productive language, but you should be aware of several limitations before choosing to use Python.

Why is Python slow?

Python was designed to be "user friendly" that is why is a dynamic typed language and not a static typed language. In dynamic languages you can change value and value type for a variable during runtime. This means there is no code optimization and there must be a garbage collector somewhere that slows down complex processes.

Another problem Python has is the GIL (global interpreter lock) this is hard to explain but it makes multi-core/parallel applications work slow. Actually this problem is resolved still for some reasons python multitasking is sluggish.

But… this it also depend on algorithms you are using. How much data you store in memory and how this data is organized. Python do not have Arrays like C, C++ and Java. Array require fix data length. In Python a collection can hold any kind of data: Numeric, String even other collections. So you can have a list of lists or a dictionary of lists. This is why Python is so slow. It uses dynamic lists.

Python snippets

You do not need to install Python to follow this tutorial. We have set-up several code snippets that you can investigate, open and modify on-line using an external website called "colab". This is free collaboration tool provided by Google and GitHub. We took advantage of this and made the examples public. Feel free to explore:

External: snippets

Python examples

We develop and verify examples with th website pages. For these examples you can have direct access. Click the link below to open demo folder. Most examples are explained in articles. If you need one you can download on your computer and study.

Internal: demo

Runnable project

For quick learning an practice you can use repl.it website. I have posted some of our examples on my account for you to review and test. You will find links to so called "homeworks" that enable you to open these examples on-line. You can log-in with your GitHub account.

Responsive Image

On-line Example

Other Resources

Making a large project in Python require practice. Professional developers work locally on desktop computers and laptops. You can setup Python interpreter on your computer. Also there is a nice IDE available called IDLE. To make advanced projects in Python I recommend PyCharm IDE editor that has a community edition.

Python I - Prep Quiz

Next quiz has only 60 questions, each question value one point. It is special designed for a mobil device. You can click, tap or scan the image below to start. This quiz does not have time limit, but it requires you to sign-in using your Google account. Break a leg!
Python Quiz

Python Quiz

Privacy Terms: We do not collect your e-mail address but we record your name with the test results on Google drive. If you take more than 80% we will recognize your skill and will endorse you on Linked-in. If you don't agree, you can use name: Anonymous but then we can't endorse your new skills.

Before taking this quiz, you should learn some Python. We organize this tutorial like a book so you can turn page by pressing the link below. Before you do, we advice you to take a break here and stretch your legs. Very important!

Start Here: Syntax Overview