Introduction to Python Programming language
Introduction to python programming language. We learnt in the previous topic how to download and install python easily for use, click here to read the previous topic that you missed.
In this topic, you’ll see how to use python to solve your daily problems and do unimaginable things in the world of programming…
Python Intro
The python programming language was designed for readability, and has some similarities to the English language with influence from mathematics. This made python one of the easiest programming language you can ever come across in your career.
Python programming language uses new lines to complete a command likewise other programming languages which often use semicolons or parentheses.
Indentation on Python programming language
The python programming language although it is very easy to read, learn and execute but it is also indentation sensitive. For a python code to run effectively, it’s indentation must be accurate.
Python relies on indentation, using whitespace to define scope. Scopes such as: the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.
Indentation refers to the spaces at the beginning of a code line.
Python uses indentation to indicate a block of code.
In most programming languages, the indentation in code is for readability only. Unlike the indentation in python, it is very important.
For example:
if 10 == 5*2:
print(“10 is a multiple of 5”)
Python would show you an error if the indentation is not correct.
For example:
if 10 == 5*2:
print(“10 is a multiple of 5”)
The number of spaces given is up to you as a programmer, the space has to be at least one, though the most common use is four.
For example:
if 10 == 5*2:
print(“10 is a multiple of 5”)
if 10 == 5*2:
print(“10 is a multiple of 5”)
You must make sure that you use the same number of spaces in the same block of code, if not, an error would be shown.
For example:
if 10 == 5*2:
print(“10 is a multiple of 5”)
print(“10 is a multiple of 5”)
In the next topic, you’ll be shown python variables and how to use them.