New Training: Introduction to the Python Language
In this 4-video skill, CBT Nuggets trainer Ben Finkel takes a first look at the Python programming language. The syntax and lexicon, the structure of code files, and how to understand and read a code file. Watch this new Programming and Development training.
Learn Programming and Development with one of these courses:
This training includes:
46 minutes of training
You’ll learn these topics in this skill:
Preparing Our Coding Environment
Basic Python Vocabulary
Our First Programming Steps
Good Programming Techniques
Pay Attention to Line Spacing in Python
Python is one of the most popular programming languages in the world. There are many reasons why. Many programmers simply enjoy working with Python. It's a fun language to work with. It's also the language of choice for scripting, data analytics, and machine learning. Because of this, many schools and businesses are now teaching Python to developers so they can leverage data analytics and machine learning in their environments. Python is a bit quirky compared to other programming languages, and line spacing is one of those quirks.
Many programming languages use a form of scoping in their syntax. Scoping is a way to segregate blocks of code similar to a function or method but in a more granular way. For instance, the code within a For Loop is scoped to that loop only. The variable used as a counter for that For Loop can only be used within that loop. That is the For Loop's scope.
A lot of programming languages use curly brackets to denote scopes. Python is different, though. Python is sensitive to white space. Unlike other programming languages, the spaces and tabs in the Python syntax have a meaning. Instead of using curly braces, Python uses indentation instead. This is something that can be confusing to programmers learning Python for the first time, so make sure to pay attention to your line spacing since it has a lot of meaning in Python.