This Python course will help the reader understand all the vital elements of the Python programming language. Anyone who wants to learn Python programming language without any prior experience in programming and anyone who wants to refresh their Python knowledge can read this article and get a grip on widely used Python concepts.
Python course – table of contents:
- Starting with Python course
- Installing Python
- Introduction to Python
- Advantages and disadvantages of using Python
- Setting up an Integrated Development Environment:
- Writing first code using VS Code IDE:
Starting with Python course
After reading this Python course, the reader will be able to write programs in Python, use any Python libraries and develop their own packages using Python.
The first step in learning any programming language is to setup the environment for writing programs. As we are going through a Python course, we will start with installing Python in three different OS platforms.
To check if python is already installed, follow the below mentioned steps.
- Press Windows ⊞ + r to get the run.
- Then type cmd and press enter.
After opening the cmd. you can check if python is already installed by using typing python into the cmd.
We can also check the version of Python installed by using commands as demonstrated below.
Now we will walk through on how to install Python in windows and links are provided for quick navigation when following the article. From the python for windows weblink, the stable version of Python can be downloaded with your choice between 64 bit or 32-bit Operating system versions.
Link for Python: https://www.python.org/downloads/windows/
As we can see, the latest release available for Python 3 is Python 3.10.0. Now click on the Latest Python 3 Release – Python 3.10.0 and it will navigate you to the downloaders page where if we scroll down to the bottom of the page, we will find a table as below.
Now click on the Windows Installer (32-bit) or Windows Installer (64-bit) according to your desire. A window will open asking you to select the path where you want to download your installer. After downloading the executable file, double click on the file to start the installation.
- Run the Python executable file, in our case it will be Python-3.10.0.exe.
- When you double-click on the file, a window will open asking do you want to run this file. Click on run to start the Python installation.
- According to your choice select if you want Python to be installed for all users or for a single user.
- Also, select add python 3.10 to PATH check box.
- Then select install now. Install now will install python with all recommended settings which is a good option for beginners.
- Then it will take few minutes for the setup to complete, and you will be taken to next dialog prompt which will ask you to disable the path length limit. This will allow the python to use long path names without any character limit of 260 which is enabled if the path length limit is not disabled.
- To verify if python is installed, you can use the Python -V or Python –version or just type Python in the cmd.
- In our first program we will just print “Congratulations!!, you have installed python correctly”.
- To write this we will use print function of python.
- Type print(“Congratulations!!, you have installed python correctly”).
- Then press enter.
- You will see that the statement we wrote inside the print is displayed as below.
Introduction to Python
Python is an interpreted high-level dynamically typed object-oriented programming language.
Before delving into writing programs in python, its important to understand what the above terms mean.
High Level Language
A high-level language gives the programmer freedom to code programs which are independent of a particular type of device. They are called high level languages as they are closer to human languages. Python is high level because it is not a compiled language, Python requires another program to run the code unlike C which run directly on local processor.
Python is interpreted language as the Python program’s source code is converted into byte code that is then executed in the Python virtual machine unlike C or C++.
Dynamically Typed Language
Python is dynamically typed language because the type of the variable is checked during run time. We will learn about data types in the following blogs.
Object Oriented Language
Python is object-oriented language, because the Python developer can use classes and objects to write clean and reusable code.
Advantages and disadvantages of using Python
Advantages of using Python
- As python syntaxes are closer to human language, it is easier to learn, understand and write the code.
- It is both functional and objected-oriented language.
- Python has a large community support and also it has large number of modules, libraries and packages.
- Due to its simplicity, developing a python program or application faster than developing in any other language like Java.
- Python is a choice of language in data science, machine learning and artificial intelligence due to its wide variety of machine learning packages and libraries.
- Almost everything can be developed using Python, it also has tools for app development such as kivy, flask, Django and many others.
Disadvantages of using Python
- It’s not recommended for communication with hardware components.
- There are no time optimizers in Python, hence it’s slower than most of the languages like C, C++, and Java.
- The indentation-based coding makes it a little difficult for people changing their language from C, C++, or Java to Python.
Setting up an Integrated Development Environment:
We will be using Visual Studio Code for writing code in Python. Visual Studio Code abbreviated as VS code is an open-source code editor with many plugins and extensions. These plugins and extensions make writing code in VS code simpler and intuitive. Also, VS code is very light compared to other IDE. It also has various themes for making the development environment interesting for the developer.
Installing VS code in windows:
- By using the link below, download the VS code executable file. Link: https://code.visualstudio.com/docs/setup/windows
- Then double-click on the downloaded file to execute it and click run. Then follow the steps as given in the images below.
- Click on I accept the agreement and click next.
- Select the checkboxes as shown in the below image and click next.
- Then click on install and it will take few minutes for the setup of VS code to complete. After completion of the setup click on finish button.
Writing first code using VS Code IDE:
- Open VS Code and you will see a window as shown below.
- Click on file to open file menu and click on new file as shown below.
- Then a tab will open in VS Code named Untitled-1 as shown below.
- Click on select a language and the below window will open where you have to select python.
- Then type the code print(“Python Installed Successfully!!!”) as shown below.
- Then Go to run tab as shown below and select run without debugging.
- Then VS code will ask you to save the file. Save the file in the directory you desire. It will run the file after saving and shows you the result as below.
Python Course From Beginner to Advanced in 11 blog posts:
- Introduction to Python Course. Part 1 Python Course from Beginner to Advanced in 11 blog posts
- Variables and Data Types in Python. Part 2 Python Course from Beginner to Advanced in 11 blog posts
- Python tuples, lists, sets and dictionaries. Part 3 Python Course from Beginner to Advanced in 11 blog posts
- Python sets and dictionaries. Part 4 Python Course from Beginner to Advanced in 11 blog posts
- Conditional statements in Python. Part 5 Python Course from Beginner to Advanced in 11 blog posts
- Loops in Python. Part 6 Python Course from Beginner to Advanced in 11 blog posts
- Python functions. Part 7 Python Course from Beginner to Advanced in 11 blog posts
- Advanced functions in Python. Part 8 Python Course from Beginner to Advanced in 11 blog posts
- Python classes and objects. Part 9 Python Course from Beginner to Advanced in 11 blog posts
- Files in Python. Part 10 Python Course from Beginner to Advanced in 11 blog posts
- Python applications in practice. Part 11 Python Course from Beginner to Advanced in 11 blog posts