Python - Introduction
#Python Programming
Hello, curious minds! Today, we're unwrapping the magic of Python programming. From zero to hero in just a few minutes, because Python is where the cool stuff happens.
Python is a multipurpose, easy to read as well as beginner friendly programming language that can be used to perform tasks from simple to complex operations. It was created by Guido van Rossum, and released in 1991.
Python is an interpreted language, meaning that code can be executed as soon as it is written. It simplifies program development by eliminating the need for compilation and linking, saving developers time.
Some common use cases for Python include:
Web/Software Development
Mathematics
Artificial Intelligence
Cybersecurity
System Scripting
Database Management
Python is designed to work on different platforms like Windows, Mac, Linux and a whole bunch of others.
Running Python
Before you can run Python code, you need to have Python installed on your system first. Now after installation, the easiest way to run Python would depend on your preference and the type of task you're working on. Here are a few methods:
Using Python Interpreter in the Terminal/Command Prompt:
Open a terminal (Linux/Mac) or command prompt (Windows).
Type
python3
and press Enter.You'll enter the Python interpreter, and you can start typing Python code directly.
To exit the interpreter, type
exit()
orquit()
, or pressCtrl + D
(on Unix-like systems).
Running a Python Script:
Write your Python code in a text file with a
.py
extension (e.g.,learning.py
).Open a terminal or command prompt.
Navigate to the directory containing your script using
cd path/to/your/script
.Run the script with
python3
learning.py
.
Using an Integrated Development Environment (IDE):
Install an IDE like Visual Studio Code, PyCharm, or Thonny.
Create a new Python file or open an existing one.
Write your Python code.
Run the code with a run button or a keyboard shortcut.
Online Platforms:
Use online platforms like Replit, Google Colab, or PythonAnywhere.
No installation required; write and run Python code directly in your web browser.
Python Syntax
Python has a clean and straightforward syntax, making it easy to learn and read. Here are just a few things to have in mind.
Python uses indentation to define blocks of code.
Python uses new lines to complete a command.
Single-line comments start with the
#
My First Python
Let's look at a simple example of printing a message to the screen
# We want to print a message to the screen
print("Hello, Fus!")
Running it will output
Hello, Fus!
Yay! You just created your first Python program. It's a breeze, right? Anyways, welcome to the world of Python programming! ๐๐.
Breathe!
Stay curious!!
Keep coding!!!
Subscribe to my newsletter
Read articles from Ifunanya Nwalusiuka directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ifunanya Nwalusiuka
Ifunanya Nwalusiuka
One code at a time