Learning the Basics of Python - This repository is to document me learning basic Python, but also for me to revist later to refresh myself of the basic topics, if needed.
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.
-
Hello World - The beginning of learning most (if not, all) programming languages, the very basic and simple printing to the command line: "Hello World!"
-
Variables and Types - Going over a few basic types of variables of Python, which is completely object oriented, and not "statically typed". You do not need to declare variables before using them, or declare their type. Every variable in Python is an object.
-
Lists - Lists are very similar to arrays. They can contain any type of variable, and they can contain as many variables as you wish. Lists can also be iterated over in a very simple manner.
-
Basic Operators - Basic Operators in Python which include: Arithmetic Operators (Addition (+), Subtraction (-), Multiplication (*), Division (/) and Modulo (%) Operators) and using Operators with Strings and Lists.
-
String Formatting - Python uses C-style string formatting to create new, formatted strings. The "%" operator is used to format a set of variables enclosed in a "tuple" (a fixed size list), together with a format string, which contains normal text together with "argument specifiers", special symbols like "%s" and "%d".
-
Basic String Operations - Exploring the various things you can do to Strings, such as: counting length (or characters) in, finding a specific character at a specific index of or between a certain range in, coverting the case (uppercase to lowercase, vice-versa) of or splitting - a string.
-
Conditions - Python uses boolean logic to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated. Conditions can be evaluated by the following operators: boolean ("and" and "or"), "in", "is" or "not".
-
Loops - There are two types of loops in Python, for and while. "for" loops iterate over a given sequence, and "while" loops repeat as long as a certain boolean condition is met.
-
Functions - Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more readable, reuse it and save some time. Also functions are a key way to define interfaces so programmers can share their code.
-
Classes & Objects - Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Classes are essentially a template to create your objects.
-
Dictionaries - A dictionary is a data type similar to arrays, but works with keys and values instead of indexes. Each value stored in a dictionary can be accessed using a key, which is any type of object (a string, a number, a list, etc.) instead of using its index to address it.
-
Modules & Packages - In programming, a module is a piece of software that has a specific functionality. For example, when building a ping pong game, one module would be responsible for the game logic, and another module would be responsible for drawing the game on the screen. Each module is a different file, which can be edited separately. Modules in Python are simply Python files with a .py extension. The name of the module will be the name of the file. A Python module can have a set of functions, classes or variables defined and implemented.
Credit goes to LearnPython.org for their great documentation and explanation of the basic topics/features of Python.