day13 of #90daysofdevops

Getting started with Python

·

4 min read

Hello đź‘‹ all,

Today we are going to learn about python.

Before start learning about python first, let's learn about the difference between scripting language and programming language.

What is the difference between scripting language and programming language?

  • All Scripting languages will become programming languages but All programming languages will not become programming languages.

  • Generally, a scripting language is interpreted. It doesn’t primarily focus on building applications- but it can render behavior to an application that already exists. It basically helps in writing codes for targeting a software system. Thus, it can also automate a given operation on any software system. So basically, scripts act as a set of instructions that target any software system.

  • Scripting languages help in automating various software apps, web pages in a browser, shell usage of an OS (operating system), etc. The scripting languages like VBScript, Perl, Javascript, Python, etc., do not require compilation, and they have less access to any computer’s native abilities.

Background of python

  • Python is a widely used general-purpose, interpreted, high-level programming language. Developed by guido van Rossum in 1991 at the national research institute for mathematics and computer science in the Netherlands.

    • Python is a simple programming language that lets you work quickly and integrate systems more efficiently.
It has multiple programming paradigms and object-oriented functional programming.

* Python is described as an interpreted and dynamic programming language with a focus on code readability. Have fewer steps to coding than Java or C++.


Python is named after the comedy television show "Monty python's flying circus." It is named after a python snake.

Features and advantages of python :

The following are some of the lists of features of the python language.

1. Interpreted: There are no separate compilation and execution steps like C and C++. Directly run the program from the source code. Internally python directly converts the source code into an intermediate form called byte code. which is then translated into the native language of the specific computer to run it. No need to worry about linking and loading with libraries etc.

2. platform-independent: Python programs can be developed and executed on multiple OS like windows, Linux, mac, Solaris and many others.

3. Free & opensource: It is free, opensource and redistributable

  1. High-level language: No need to take care of low-level details such as managing memory used by the program.

5. simple: closer to the English language, easy to learn, More emphasis on the solution to the problem rather than syntax

6. Embedded: Python can be used with multiple other languages to give scripting capabilities for the program's users.

7. Robust: Exceptional handling features, Memory management techniques in building.

8. Rich library support: It provides a vast range of libraries for various fields including machine learning, AI, scripting etc.

  1. Gui programming support: Python provides various libraries for GUI development. PYQT5, Tkinter, Kivy etc. are some of the common libraries

10. Dynamically Typed: It is dynamic which means, python decided the type for a value at runtime and hence we do not need to specify the type of data while declaring it.

How to install :

You can download the Python interpreter here: https://www.python.org/downloads/ Python IDE An IDE is a development environment. If you don’t want to work from the terminal, you can use an IDE. This is a graphical editor in which you can type code, work with multiple files, run code amongst other things.

pycharm python ide

image

In the PyCharm IDE above you see 1) file menu, 2) the code, 3) main menu, 4) line numbering, 5) scrollbar, 6) files and program output and 7) additional information. Most IDEs have a structure like this.

IDEs can save you a lot of development time, unless you are a terminal expert. You can quickly work with multiple files, switch between projects and work with multiple people on one project.

Some popular Python IDEs are PyCharm, PyDev and Wing IDE.

Execution of python scripts

Execute Python scripts in the terminal or an IDE. Python files have the .py extension. Whenever you make a Python script, save it as name.py Run Python Run from terminal

Run from IDE To run a Python script from an IDE, start a project first. Once the project is created add your .py files (or create them in the IDE) and press run.

In the PyCharm IDE:

Start project Welcome screen opens, click Create New Project. On the main

menu, choose File | New Project. Select Python interpreter Choose Python version from the list. Use 3.x Click create Add new Python file (File new) and add hello.py Click the green triangle to start the program. Another option is to click right mouse button on your Python file and selecting run. Other IDEs have a similar process to run a Python program (start project, add file, run button).

You should see a line of text showing “hello world”. python windows

Generally all other programming languages like java, c, c++ uses {} to represent a block of code. But , python uses indentation(:) to represent a block of code. Indentation is nothing but a four white spaces .

indentation is used to better convey the program structure.

That's it for today.

See you all tommorow with another blog. Until then keep learning.

Thanks for your time.

Please like , share and comment your feedback.

Did you find this article valuable?

Support CharanWrites by becoming a sponsor. Any amount is appreciated!

Â