DEV Community

Susmita Dey
Susmita Dey

Posted on • Edited on

Getting Started With Python

Introduction to Python

Python is a simple, well-structured, easy-to-read syntax interpreted high-level programming language.

Programming Language:- A human readable language used to give instructions to computers, written in various ways and compiled by using a compiler and then converted to machine-understandable language to process the desired work.

There are many programming languages in the world. But among all of them Python is the most popular programming language.


History of Python

The programming language Python was conceived in the late 1980s, and its implementation was started in December 1989 by Guido van Rossum at CWI in the Netherlands as a successor to ABC capable of exception handling and interfacing with the Amoeba operating system. Van Rossum is Python's principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, Benevolent Dictator for Life (BDFL). (However, van Rossum stepped down as leader on July 12, 2018.).
Python was named after the BBC TV show Monty Python's Flying Circus.

Guido_van_Rossum_OSCON_2006_cropped(Father of Python).png
Picture -> Monte van Rossum

Source -> Wikipedia


Why Python?

  • Easy to Read and Debug
  • Helps to write Clean Code
  • Easy Syntax
  • Many things can be done by writing fewer lines of code, whereas, in other language you have to write more lines of code to do the same task.

Where Python is used?

It is used in the following cases -

  • Making Games
  • Making Web Apps
  • Artificial Intelligence
  • Data Science, and many more.

Setting Up Python In Your Computer

You can download python from here.
Then install it as you install a software on your computer.


Python Current Versions

Every day technology is evolving and software and programming languages are also upgrading everyday and new versions are coming up.
Basically, Python has two versions now - Python2 and Python3.
If you've already installed python on your computer and you're using Python2, then I would recommend you to upgrade it to Python3.


Checking your Current version of Python

  1. Type cmd in your search box of Windows.
  2. Open Command Prompt
  3. Type the following command and hit Enter.
python --version
Enter fullscreen mode Exit fullscreen mode

You will see something like this -
image.png


Checking Python In Terminal After Installation

After you've installed Python on your system, now you have to check whether it is perfectly working on your system or not.

Follow these steps:-

  1. Open your terminal(Command Prompt)
  2. Type python and hit Enter. It will come up like this - image.png
  3. Type the following and hit Enter.
print("Hello World")
Enter fullscreen mode Exit fullscreen mode
  1. The output should appear like this - image.png
  2. Now, this proves that Python is working perfectly on your system.
  3. Now type exit() and hit Enter and then close the terminal.

Congratulations. 🎉 You have done your first Python program via the terminal. 😃


Use of Python files

It's not always a good practice to write your code in the terminal and run it to get the output. Also, it doesn't save your in the terminal. So, we all create a Python file to save our code on our machine and we use a code editor or IDE to compile our Python file having the source code and get the output.

You can use any code editor or IDE you like based on your requirements. You can use PyCharm. I personally love to use Visual Studio Code and it's beginner friendly too.


Some IDE's and Code Editors for Python


Setting Up Visual Studio Code for Python

  1. Download and install Visual Studio Code from the link given above. It's free of cost.
  2. Open it and then go to the Extension Tab. image.png
  3. Type python in the search bar and click on the first one powered by Microsoft.
  4. Install it and reload the VS code after installing the extension. image.png Since, I've already installed, it's showing it me the two buttons Disable and Uninstall. But when you'll install it for the first time, there will only one single Install button there for you. After installation, it should show like the above image.

👀 Note that, it's an extension so no options like Next Next buttons in a dialog box will appear before you. It will get install automatically as you click on the Install button.


Writing Program in Visual Studio Code

  1. Create a python file in the sidebar with add.py and hit enter.
  2. Select the interpreter for Python by using the shortcut Ctrl+Shift+P. image.png
  3. Write the following code in your file.
a = 5
b = 7
sum = a + b
print(sum) 
Enter fullscreen mode Exit fullscreen mode
  1. Save your file and run it using the Run Code button located on the top right corner of VS Code.
  2. The output should come like this:- image.png

Congratulations. 🎉 You have learnt how to add two numbers and print the value. 😃


Explaining the Code

a = 5
b = 7
s = a + b
print(sum)
Enter fullscreen mode Exit fullscreen mode

Here, a, b and s are variables. We have assigned a value 5 to a and 7 to b. Then we have added the two numbers 5 and 7 and stored it into s variable. Then we're printing the value of sum of two variables a and b. Here, print() is an in-built function used to print any values or names as Output.

For now, you understand it as like you have 3 bowls with you and the first 2 bowls contain some items in it and we're mixing the items together in the 3rd bowl and displaying the mixture.

We'll cover variables and data types and all other things in detail in our upcoming articles.


You can also watch this video for clarity.


Hope this helps you. Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my YouTube Channel and connect on LinkedIn or Twitter.
Also, feel free to support my work.😊

Top comments (0)