DEV Community

Geraldine88
Geraldine88

Posted on

PYTHON 101: INTRODUCTION TO MODERN PYTHON

Python 101 : INTRODUCTION TO MORDEN PYTHON

Image description
The Python language type is a high-level cross-platform free and open-source, dynamically typed one that is among the most popular general-purpose programming languages. It is among the world’s fastest-growing programming languages and is used by software engineers, mathematicians, data analyst, scientists, network engineers, students and accountants.
Python is a very easy programming language to pick up, is beginner-friendly which prioritizes readability. Its syntax has similarities with the English language, so if you have chosen Python to learn as your first programming language, you are in very good hands.
Python was created in 1989 by Guido van Rossum and released later in 1991. Guido’s main priority in creating Python was to make programming easier. As to how the name “Python” came about, Guido took inspiration from a BBC comedy book titled “Monty Python Flying Circus” and decided he needed a short name, slightly mysterious and unique.

Getting started with Python
Python, as mentioned earlier is a cross-platformed programming language, meaning it can be ran on Windows, Linux or MacOS.
Installation
Python installation is a piece of cake, and recently a lot of LINUX and UNIX distributions have Python. Even some Windows machines have Python already installed on it. Check out https://www.python.org/ to know how to install python for the first time.

– Check if you already have python installed via command line.

  • On your device, click the search icon and type cmd to search for the Command Prompt.
    Image description

  • Check if you already have python installed.
    On your command prompt, type in the command python –version, python -V or py –version to see if you already have python installed and placed in your environment variables. These commands also tell you what version is installed in your device.
    As you can see on the image below, I have version 3.9.7 installed on Windows.
    You can also find the location where it was installed using the where.eve python command.

Image description

If python hasn’t yet been installed on your desktop, then visit https://www.python.org/downloads/windows/ select the version suitable for your device (whether 64-bit or 32-bit)

Image description

Image description

Image description

Installation was successful. To verify if python was correctly added to your path, check the python version on command prompt as shown above.
OR to add python to your environment variables, click on the search icon and type in “python” and open its location
Image description

Copy the file location highlighted in blue as in the image below;
Image description

Click on the search icon again and type in “Edit the system environment variables” and enter.
A little dialog box will pop up and then click on “Environment Variables”
Image description

In the environment variables, double-click on “Path” to add the python path and click on “OK”
Image description

Now to check if python is properly installed in your machine once more, open command prompt and type in python –version command.

Python IDE:

Haven installed python and added it to your environment, open the search bar and type in “Python IDLE” and open.
Image description
When the IDLE is opened, it looks like this;
Image description
Navigate to File>New file to open a new python file and save this file in any desired location or press CRTL+N keys to open a new python file.
Save the file as “hello_world.py” or in our case “hello_pythonista.py”

Typing in your first python program as it is below; Image description

Save this program and run this program as in the image below;
Execute the program

Image description
Image description

Alternatively to run your code from the command prompt:

  • open the command prompt

  • Navigate to the folder containing your '.py' file

  • Run the command python fileName.py then hit "Enter".

Image description

HURRAY! You have executed your very first program as a python programmer.
Welcome to the world of Python. Pretty easy and interesting, isn’t it?

Pep talk

As you have seen, writing programs is very easy. One of my teachers made the definition of programming very easy as “Programming is simply telling your computer what to do”.
CONSISTENCY is the key as a programmer and to be consistent, you must be disciplined to know exactly what you want.

To learn more about python, you can visit the following;

Top comments (0)