Python Tutorial 3W: Master the Basics in Weeks

Logan Jul 13, 2026

Welcome to our comprehensive Python tutorial designed for absolute beginners and those keen to refresh their knowledge. Python is a powerful and versatile language, hailed for its readability and ease of use, making it an excellent choice for both beginners and experienced developers alike. Let's dive into the world of Python, exploring its basics, data types, and control structures.

Getting Started with Python

Game Development with Python Programming...
Game Development with Python Programming...

Python's popularity can be attributed to its simplicity and the vast number of use cases it supports, from web development to data analysis and scientific computing. To start with Python, you'll first need to install it on your system.

All Important Python Functions for Beginners (Complete Cheat Sheet)
All Important Python Functions for Beginners (Complete Cheat Sheet)

Python offers two primary environments to run and write code: Python shells and integrated development environments (IDEs). Python shells allow users to test small snippets of code, while IDEs provide a rich set of features for writing, debugging, and testing Python applications.

Setting Up Python

Master Python Methods: A Quick Guide for Beginners!
Master Python Methods: A Quick Guide for Beginners!

Visit the official Python website (https://www.python.org/downloads/) to download the latest version of Python. Follow the installation instructions for your operating system. Once installed, you can verify the installation by opening the command-line interface and typing:

python --version

This command should display the installed Python version.

30-Day Python Learning Plan for Beginners | Complete Python Roadmap to Learn Coding Fast
30-Day Python Learning Plan for Beginners | Complete Python Roadmap to Learn Coding Fast

Running Python Code

To run Python code, you can use Python shells or IDEs. Jupyter Notebook, PyCharm, and Visual Studio Code are popular choices for Python development.

Here's a simple Python program to print "Hello, World!" using the print() function:

Python Coding Practice | Easy Programming Logic
Python Coding Practice | Easy Programming Logic

print("Hello, World!")

When you run this code, it will display: Hello, World!

Python Basics and Data Types

Python has several data types, including integers, floats, strings, lists, and dictionaries. Understanding these data types is crucial for writing effective Python code.

Python Cheat Sheet for Beginners
Python Cheat Sheet for Beginners

Variables in Python are used to store data values. Here's how you can declare variables and assign values:

x = 10 y = 20.5 name = "John"

Numbers

Python Cheat Sheet for Beginners 2026 | Python Basics, Syntax, Loops, Functions & Variables
Python Cheat Sheet for Beginners 2026 | Python Basics, Syntax, Loops, Functions & Variables
a man holding up a poster with the words 5 levels of python on it
a man holding up a poster with the words 5 levels of python on it
How to Use the String join() Method in Python
How to Use the String join() Method in Python
👩‍💻 Python for Beginners Tutorial
👩‍💻 Python for Beginners Tutorial
a computer screen with the words python string method
a computer screen with the words python string method
Python Notes for Beginners (Easy + Quick Guide)
Python Notes for Beginners (Easy + Quick Guide)
the top 50 python project ideas
the top 50 python project ideas
How to Check the Version of Python
How to Check the Version of Python
Python to_timestamp Easiest Way to Implement with Examples
Python to_timestamp Easiest Way to Implement with Examples
Learn Python - Full Course for Beginners [Tutorial]
Learn Python - Full Course for Beginners [Tutorial]
Python Projects Ideas For Beginners
Python Projects Ideas For Beginners
30 Python Projects For Beginners and Advanced Learners (2023)
30 Python Projects For Beginners and Advanced Learners (2023)
9 Python Projects for Beginners (Build Your Portfolio Fast)
9 Python Projects for Beginners (Build Your Portfolio Fast)
Game Development with Python Programming...
Game Development with Python Programming...
Python in Easy Steps
Python in Easy Steps
Easy webscraper bot with Python!
Easy webscraper bot with Python!
Python Basic | Part 5
Python Basic | Part 5
9 Python Loop Tricks Every Beginner Should Learn (Cheat Sheet)
9 Python Loop Tricks Every Beginner Should Learn (Cheat Sheet)
an image of different types of words in python
an image of different types of words in python

Python supports two types of numbers: integers and floats.

Let's declare some integer and float variables:

x = 10 y = 30 z = 10.5

Python also provides basic arithmetic operations like addition, subtraction, multiplication, and division:

result = x + y # Addition result = x - y # Subtraction result = x * y # Multiplication result = x / y # Division (results in float)

Strings

Strings in Python are immutable sequences of characters. You can use single or double quotes to declare strings:

name = "John" name = 'Doe'

You can use concatenation to combine strings using the + operator:

full_name = name + " " + "Doe"

Python also supports string formatting using f-strings (Python 3.6 and above):

full_name = f"{name} Doe"

Control Structures in Python

Control structures in Python allow you to create conditional and iterative logic in your code. Python supports if-else statements, for loops, and while loops.

Let's explore the if-else statement to demonstrate conditional logic. In this example, we'll check if the user is eligible to vote based on their age:

age = 20 if age >= 18: print("You are eligible to vote.") else: print("Sorry, you are not eligible to vote.")

For Loops

For loops in Python allow you to iterate over a sequence of values. Here's an example of a for loop that prints numbers from 0 to 4:

for i in range(5): print(i)

You can also use for loops with lists and other sequence types:

fruits = ["apple", "banana", "orange"] for fruit in fruits: print(fruit)

While Loops

While loops in Python execute a block of code as long as a specified condition remains true. Here's an example that prints numbers from 0 to 4 using a while loop:

i = 0 while i < 5: print(i) i += 1

Keep practicing and exploring Python's vast ecosystem of libraries, frameworks, and tools. The more you code, the better you'll become. Happy coding!