Python

Introduction to Programming with Python

What is Python?
Python is a very popular programming language that was first released in 1991, however, only gained traction in recent years.
A computer programming language is a way of expressing a set of detailed instructions to be executed by a computer. Python, just like many other programming languages, does that and more.

Some common use cases of Python today
Python can be used to perform complex mathematical operations.
Python has robust libraries that help handle big data and conduct data analysis on complex data sets.
Python can be used for software development and more…

Advantages of using Python
The syntax of Python allows developers to write fewer lines of code compared to other programming languages.
Python can run on Mac OS, Windows, Linux, and more.
Python supports many programming paradigms such as Object-Oriented, functional, and structured programming.
Python is an open-source project.
Python has a good support community due to its popularity.

How to install Python
1. Check if you already have Python installed on your PC
Launch the command line interface or terminal, type the command below, and execute it (Enter).
python --version
If Python is already installed, the version number is displayed on the screen.

2. If you need to install it, you can download it from the official website for installation.
If needed, run the command in step one to verify that the installation was successful.

Write your first program in Python

Your first task is to write a Python program that displays the message “Welcome to Python programming”.
This can be done through the command line or a script.

Using the command line
Launch your command line or terminal
Type python – This will launch the Python interpreter
You should see three arrows >>>
Type print("Welcome to python programming") and hit enter – Python has a built-in function called print(). This function takes in Python data and prints it to a screen. The data can be a string, number, etc…

You should have a similar result as shown below with the message printed/displayed on the screen

Using a script
Create a file and save it as MyFirstProgram.py
The extension “.py” indicates the type of file or script it is. In this case, a Python script.
Open the file with a text editor like Notepad and Type print("Welcome to python programming")
Save the file
Go to your command line, navigate into the directory or location where the file is saved, and execute the script
python MyFirstProgram.py

What's your reaction?

Excited
1
Happy
1
In Love
0
Not Sure
0
Silly
0

You may also like

Leave a reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.