Hello Engineers! Hope you all are doing great. In today's tutorial, I am giving you a detailed lecture on Python programming language. As I am writing this tutorial for beginners, that's why I will discuss each & everything in detail, so it's going to be a very lengthy tutorial and I have divided it in parts.
We will start from basic concepts in Python and will slowly move towards advanced concepts. It's going to be a quite long bumpy ride but I will try my best to make it as smooth as I can. So, let's get started with basic Introduction to Python Language:
Introduction to python
- Python is a multi-purpose, object-oriented High-Level Programming language, with applications in multiple areas, including scripting, machine learning, data sciences, scientific learning, cloud computing and artificial intelligence.
- It is the most popular language of 2019, and it is going to flourish exponentially in upcoming years because of its versatility & flexibility.
- Organizations like Google, NASA, and CIA are using it already.
- Python processes at RUNTIME by the INTERPRETER, so you don't need to compile your program before executing it.
- There are three major versions of Python programming language are available i.e. 1.X, 2.X and 3.X. They have sub-versions such as 2.2.3 and 3.3.1.
So, the IDE (Integrated Development Environment) which I am going to use is PyCharm Community Edition.
- PyCharm Community Edition is free of cost and open-source. You can use it easily.
- Jetbrains developed this for professional developers.
Prerequisites for Python
As I have told you earlier, I will start from the very basics and will cover almost everything about Python, so if you follow & practice this tutorial completely then you will surely learn Python, even if you are a beginner and know nothing about programming. But still, it would be better if you have:
- knowledge of some basic concepts like loops, control statements, variables, etc.
- It is not required to learn any other programming language before you learn python.
- It is not required to have an engineering background to learn this language.
- If you are from any other discipline like Sciences, Social sciences or any other academic field, you can still learn it.
Uses of Python
- As I have mentioned earlier, Python is used in various areas like Machine learning, scripting, scientific computing, Artificial Intelligence, cloud computing etc.
- So many communities are forced to use python these days, such as:
- Network Engineers.
- Software Engineers.
- Data Analysts.
- Website & App Developers.
- A wide range of jobs are using this multi-purpose language, namely:
- Desktop application development.
- Mobile application development.
- Web application development.
- Automation Scripts.
- Algorithmic and high-frequency trading.
- Machine learning.
- Artificial intelligence.
- Software testing.
DATA SCIENCE AND MACHINE LEARNINGData science and machine learning are the main reasons, why programmers are learning this language.
- Python offers different frameworks and libraries, for example, PyBrain, PyMySQL, and NumPy.
- Python experience allows you more than R Language.
- You can create scripts to automate material and go with web developments, and so on, respectively.
- If you want to work in machine learning, you can easily work with Python.
- Some of the examples of machine learning are, google chatbots. They answer your questions and queries through python algorithms.
Download & Install PythonEnough with the theoretical stuff, now let's get our hands on Python software:
- First of all, you need to download Python, they have provided Python for Windows, Linux/UNIX, Mac OS X etc.
- At the time of this writing, Python 3.8.3 is the latest version, so download & install it.
- Make sure you check the Python path when you continue, otherwise, it will not work in the future.
- Next, we need to download PyCharm, which is the IDE for professional developers.
- You will find two versions on its download page i.e. Professional and Community.
- We are going to download the community version for now, as we are in the learning phase.
- You can download PyCharm for Windows, Mac & Linux.
- After downloading the PyCharm, simply install it.
- During installation, you need to check on the
- 64-bit launcher.
- Add launcher dir to the PATH.
- Create Associations .py
- I have ticked these 3 options, as shown in the below image:
- Now click on the Next button and then click on Install and PyCharm will be installed on your computer.
- You need to restart your computer for adding launcher dir to the PATH.
Creating First Python Project on PyCharm
- Click the PyCharm icon and open the IDE.
- On its first run, it will ask for the UI theme, which I am going to select Dracula, as I like the dark one.
- Now, click on "Create New Project, select the location where you want to save your file and then click close.
- In the left window titled Project, we have a tree structure of our files.
- These are library files that are necessary for running the project successfully, we will discuss them later.
- So, in this Project Panel, we need to right-click on our Project Folder and then New and then select Python File, as shown in the figure on the right side.
- Give a name to your file, as I have named it myy.py.
- Now let's write our first line of code:
print("my world, my rules")
- Click on Run in the top menu bar then select Run. You can also use the shortcut key (Alt+shift+F10).
- IDE will ask you to select the file for execution, so we need to select our python file.
- Once you select your python file, a new dialog box will open up at the bottom, and you will find your string printed there i.e. my world, my rules.
- Here's the screenshot of our first Python code in Pycharm:
- So, we have successfully executed our first Python code in PyCharm. :)
So, that was all for today. I hope now you have a better understanding of what python is and why its so popular. If you have any questions, please feel free to as kin comments. In the next lecture, we will have a look at datatypes in python. Till then take care and have fun !!! :)