Introduction to Python programming
Welcome to the online Python tutorial series at devsought . We will discuss python from the basics, intermediate to advanced levels using easy to follow and understand examples with explanations, to help you move from beginner to expert easily. Let’s jump straight into it.
Python is a simple, dynamic, interpreted, robust, high level programming language. It has found major applications in modern day applications in web development, Artificial Intelligence and Machine Learning owing to its simplicity, well written modules/libraries you can easily use to accomplish complex tasks with ease.
Running Python
Python modules/.py files
Python source code uses .py file extension. Python source files are also known as modules
Sample contents-Example
python_intro.py file contains the below instructions.
print('Devsought is a cool Python resource site')
To execute the file we call the command python python_intro.py as below with output shown.
Running Python from the command line
Python can also be run on the terminal by using the python command on Windows,Mac,Linux.If that does not work,the py command can be used as well.
This method is mainly used for quickly testing a program while doing development or for short demos.However,any Python code can be written
Example
Once we are done running our code, we type exit() to quit the command line interface.
Example 3
Variables can be set in the CLI interpreter session and used as shown above.
Typing a variable name later in a new in the session and pressing Enter key prints the content of the variable as shown above.