Coding Tutorial

Python for Absolute Beginners: Your First Program in 10 Minutes

Learn Python programming from scratch. Write your first program, understand variables, data types, and build a practical tip calculator.

March 27, 2025 10 min read
Python programming

Want to learn coding but don't know where to start? Python is the perfect first language. It's readable, powerful, and used everywhere from web development to artificial intelligence. In this tutorial, you'll write your first Python program in just 10 minutes—no previous experience needed.

Why Python?

Python has become the most popular programming language for beginners, and for good reason. The syntax reads almost like English, making it easier to focus on programming concepts rather than complex grammar. Companies like Google, Netflix, and NASA use Python daily.

What Makes Python Great for Beginners

Readable syntax, versatile applications (web, AI, data science), forgiving of mistakes, massive community support, and in-demand job market.

Installing Python

Before we start coding, you need to install Python on your computer. The process takes about 2 minutes:

Windows: Download from python.org/downloads, check "Add Python to PATH" during installation, and click Install.

Mac: Open Terminal and run brew install python3

Linux: Run sudo apt install python3 in your terminal.

To verify installation, open your terminal and type:

python --version

You should see Python 3.12.x or similar. If you see this, you're ready to code.

Your First Python Program

Type python in your terminal. You'll see the Python interpreter start with >>> prompts. This is where we'll write our first program.

print("Hello, World!")

Press Enter, and you'll see:

Hello, World!

Congratulations! You just wrote your first Python program. The print() function displays text on screen, and the quotes around "Hello, World!" tell Python this is text data (called a string).

Understanding Variables

Variables are containers for storing data. Think of them as labeled boxes where you can put information and retrieve it later.

name = "Alice"
age = 25
height = 5.9

print(name)
print(age)
print(height)

In this example, name stores text, age stores a whole number, and height stores a decimal number. Python automatically figures out what type of data each variable holds.

Data Types in Python

Python has several built-in data types. Here are the most common ones you'll work with:

Strings (text): Enclosed in quotes, like "Hello" or 'World'

Integers (whole numbers): Like 25, 100, -5

Floats (decimal numbers): Like 19.99, 3.14

Booleans (true/false): Either True or False

Basic Math Operations

Python works great as a calculator. You can perform all basic mathematical operations:

# Addition
print(5 + 3)  # Output: 8

# Subtraction
print(10 - 4)  # Output: 6

# Multiplication
print(6 * 7)  # Output: 42

# Division
print(20 / 4)  # Output: 5.0

# Exponents
print(2 ** 3)  # Output: 8

Building a Tip Calculator

Let's create something practical—a tip calculator. This program will take a bill amount and calculate the tip and total.

# Tip Calculator
bill_amount = 50.00
tip_percentage = 15

# Calculate tip and total
tip = bill_amount * (tip_percentage / 100)
total = bill_amount + tip

# Display results
print("Bill Amount: $" + str(bill_amount))
print("Tip (15%): $" + str(tip))
print("Total: $" + str(total))

When you run this, you'll see:

Bill Amount: $50.0
Tip (15%): $7.5
Total: $57.5

The str() function converts numbers to text so we can combine them with other strings using the + operator.

Taking User Input

Programs become more useful when they can interact with users. Python's input() function lets you get information from the user:

name = input("What is your name? ")
print("Hello, " + name + "! Nice to meet you!")

Let's make our tip calculator interactive:

bill = float(input("Enter bill amount: $"))
tip_percent = float(input("Enter tip percentage: "))

tip = bill * (tip_percent / 100)
total = bill + tip

print(f"Tip: ${tip:.2f}")
print(f"Total: ${total:.2f}")

The f before the quotes creates an f-string, which lets you insert variables directly into text. The :.2f formats numbers to 2 decimal places.

Practice Exercises

Try these exercises to test your understanding:

Exercise 1: Create a program that asks for your name and age, then calculates what year you were born.

Exercise 2: Write a program that asks for the length and width of a rectangle, then calculates and displays the area.

Exercise 3: Create a temperature converter that takes Celsius and converts it to Fahrenheit using the formula: (celsius * 9/5) + 32

What's Next?

Now that you can write basic Python programs, here's what you should learn next:

Week 1-2: If statements (making decisions) and loops (repeating actions)

Week 3-4: Functions (reusable code blocks) and data structures (lists, dictionaries)

Month 2: Build projects like a calculator, to-do list app, or simple game

Learning Tip

Code every day, even if just for 15 minutes. Consistency beats intensity when learning programming.

Free Learning Resources

Official: Python Official Tutorial

Interactive: Codecademy Python Course

Video: FreeCodeCamp Python Course (search for "freeCodeCamp Python")

The best way to learn is by doing. Start with small programs, make mistakes, fix them, and gradually build more complex projects. Every expert programmer started exactly where you are now.

TechPulse Daily
Daily coding tutorials and programming insights.