DEV Community

HannahMwende
HannahMwende

Posted on • Edited on

Introduction to modern python

Image description
Python is an interpreted, high-level programming language with dynamic semantics. Python programs have the extension.py and can be run from the command line by typing python file_name.py.

Why learn Python?

  • It is also quite easy to learn, understand, code and a developer-friendly language.

  • Python is free and open sourced. Not only can you download Python for free, but you can also download its source code, make changes to it and even distribute it.

  • Python supports object-oriented programming and concepts of classes, objects encapsulation, etc.

  • Python can be extended to other languages. You can write some of your code in languages like C++ or C. This comes in handy, especially in projects.

  • Easily portable as it can be shared and you can run a code on any platform.

  • Python has extensive libraries that contain codes for various purposes.So, we don’t have to write the complete code for that manually.

Where can Python be used ?

  • Artificial Intelligence and machine learning.

  • Web development.

  • Game development.

  • Data science.

  • Audio and Visual Application.

  • Software Development.

  • Automation.

Setup your python working environment

For starters or data science enthusiasts,install anaconda

Anaconda | Individual Edition
Anaconda's open-source Individual Edition is the easiest way to perform Python/R data science and machine learning on a single machine. (19 kB)

Image description
For software developers/engineers install python interpreter ( preferably Python 3.8) here
Image description

Also install a text editor of your choice.I prefer Visual Studio Code which can be downloaded through this link.

At the end of the installation,confirm your installation by opening the terminal and type:

python --version
Enter fullscreen mode Exit fullscreen mode

Then it should print the python version you just installed.
Now we are all set and you can proceed to create your first program!

Launch VS Code and create a new file where your codes will be saved and it must have the .py extension.
For instance,I will create a file called helloworld.py and type in :

print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

Save your file. Open your command line, navigate to the directory where you saved your file, and run the code.
The output should be:

Hello World!
Enter fullscreen mode Exit fullscreen mode

Congratulations, you have written and executed your first Python program.

Top comments (0)