Introduction to Python
In this lesson, we will explore the history of Python and how it has changed over time (occasionally breaking backwards compatibility). We will see that Python is a platform that allows you to build all sorts of applications including web apps, GUI apps, and more. You will learn how to install and configure Python on both Windows and OS X. You will see some tips and tricks to using the interpreter as well as directly executing Python applications and scripts. We will discuss a variety of tools for working with Python from basic text editors to full blown IDEs including PyCharm, Visual Studio, Eclipse, Sublime Text and how to configure them. In short, you'll be ready to dig into specific Python topics after this lesson.
Python is a unique language which values readability and productivity over terseness. In this lesson, you will get a quick introduction to the major language features. We start by examining the 'shape' of a Python application. Unlike many languages, whitespace is not just significant, but it defines blocks (or suites) of code. We will see how to define variables and understand Python's variable scope. Next up is a variety of flow control constructs (if, while, etc.). We will pay special attention to loops in Python, which unlike many languages omits any form of index-based loops (e.g. for loops in C). Finally we discuss how to import external modules and packages to extend our capabilities.
Working with basic types and collections
Python has a rich type system. This lesson explores some of the fundamental types and tips for working with them (numbers, strings, dates, etc.). Next we move on to the collection classes (lists, sets, dictionaries, etc.). These types have very powerful features and only some of them are covered in this lesson (saving the best for deeper examination later). You will learn to splice, combine, and generally manipulate these collections here.
“Great course, the trainer was really professional”
Functions, along with classes, are key building blocks of any self-respecting language. Python's support for functions is very sophisticated. We start by defining basic functions and discussing parameters, return values, and related concepts. Unlike many languages, you will see that Python functions naturally support returning multiple return values and assigning them all in one step. You will see how to define functions with varying numbers of parameters. Finally we look at some of the best features of functions enabling modern, concise programming techniques: closures and lambdas in Python.
Python is a first class object-oriented language. Many of the APIs are implemented as objects and all classes have a common base class just like languages such as Java and C#. You will see how to define your own classes and how to add methods and fields to them. We will discuss Python's special methods which are essentially Python's way to implement operator overloading and more. There are techniques to add data-hiding and encapsulation to your classes as well as single and multiple inheritance. We discuss how polymorphism is done in Python and it's clever use of duck-typing.
Python has a solid try / catch error handling system. This lesson will explore catching and handling errors via exceptions. Throwing and signaling errors to calls when errors occur in our code. You will learn how to define your own exception types. Finally, we will use the with language keyword to ensure that we properly clean up resource intensive code blocks (e.g. file streams or open database connections)
Working with files is fundamental to any programming language. Python has rich support for working with files including simple utility methods to load all data as well as more efficient streaming APIs. Beyond reading and writing text or bytes, we will explore intrinsic support for common file formats (JSON and XML) as well as object serialization via pickle. Finally, we look at two classes which provide access to files, directories, and more: os and sys.