Introduction

April 3, 2026
#python #programming #getting-started

If you’ve been curious about programming but weren’t sure where to start, Python is one of the best first languages you can pick up. It reads almost like English, it doesn’t require a lot of boilerplate to get things done, and it’s used everywhere — from web apps and automation scripts to data science and artificial intelligence.

In this tutorial, we’ll get Python installed, write our first program, and explore the building blocks you’ll use in every Python project: variables, data types, and input/output. By the end, you’ll have a working program and a solid foundation to build on.

What is Python?

Python is a high-level, interpreted programming language. “High-level” means it abstracts away the low-level details of the computer (like memory management), so you can focus on solving problems. “Interpreted” means your code is executed line by line — there’s no separate compilation step like in languages such as Java or C++.

If you’ve worked with JavaScript before, you’ll find Python’s philosophy familiar: get things working quickly, keep the code readable, and don’t overthink it. The biggest visual difference is that Python uses indentation to define code blocks instead of curly braces.

Notice how Python’s version has the least ceremony. That’s by design.

Installing Python

Before writing any code, you’ll need Python installed on your machine. Python 3 is the current standard — don’t install Python 2, as it’s no longer supported.

Running Your First Program

There are two ways to run Python code: the interactive interpreter and script files. Let’s try both.

The Interactive Interpreter

Open your terminal and type python3. You’ll see a prompt that looks like this:

Python 3.12.0 (main, Oct  2 2024, 00:00:00)
>>> 

The >>> is Python’s way of saying “I’m ready for input.” Try typing:

>>> print("Hello, World!")
Hello, World!

The interpreter is great for quick experiments. Type exit() when you’re done.

Running a Script File

For anything beyond a quick test, you’ll want to save your code in a file. Create a file called hello.py and add the following:

print("Hello, World!")
print("Welcome to Python!")

Run it from your terminal:

python3 hello.py
Hello, World!
Welcome to Python!

That’s it — you’ve written and executed your first Python program.

Variables and Print

Variables in Python are straightforward. You don’t need to declare a type — Python figures it out based on the value you assign.

name = "Alice"
age = 30
height = 5.7
is_student = False

print(name)
print(age)
print(height)
print(is_student)
Alice
30
5.7
False

You can also use f-strings (formatted string literals) to embed variables directly inside strings. This is the most common way to build output in modern Python:

name = "Alice"
age = 30

print(f"{name} is {age} years old.")
Alice is 30 years old.

Basic Data Types

Python has several built-in data types. Here are the ones you’ll use most often:

Type Example Description
str "hello" Text (strings)
int 42 Whole numbers
float 3.14 Decimal numbers
bool True / False Boolean values
list [1, 2, 3] Ordered, mutable collection
dict {"key": "value"} Key-value pairs
None None Represents “no value”

You can check the type of any value using the type() function:

print(type("hello"))    # <class 'str'>
print(type(42))         # <class 'int'>
print(type(3.14))       # <class 'float'>
print(type(True))       # <class 'bool'>
print(type([1, 2, 3]))  # <class 'list'>

Python is dynamically typed, which means a variable can hold different types at different times. This is flexible, but it also means you need to be mindful of what type a variable holds — especially as your programs grow.

Simple Input and Output

The input() function lets you read text from the user. It always returns a string, so you’ll need to convert it if you want a number.

name = input("What is your name? ")
print(f"Nice to meet you, {name}!")
What is your name? Alice
Nice to meet you, Alice!

For numeric input, wrap input() with int() or float():

age = int(input("How old are you? "))
print(f"You will be {age + 1} next year.")
How old are you? 30
You will be 31 next year.

Putting It Together: A Practical Example

Let’s build a simple tip calculator that takes a bill amount and tip percentage, then tells you what to pay. This uses everything we’ve covered — variables, data types, input, output, and f-strings.

# Tip Calculator
bill = float(input("Enter the bill amount: $"))
tip_percent = float(input("Tip percentage (e.g., 15 for 15%): "))

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

print(f"\nBill:  ${bill:.2f}")
print(f"Tip:   ${tip_amount:.2f}")
print(f"Total: ${total:.2f}")
Enter the bill amount: $52.75
Tip percentage (e.g., 15 for 15%): 18

Bill:  $52.75
Tip:   $9.50
Total: $62.25

The :.2f inside the f-string formats the number to two decimal places — handy for currency.

What’s Next?

You’ve installed Python, run your first script, and worked with variables, data types, and user input. That’s a solid start. From here, you’ll want to explore control flow (if/else statements and loops), functions, and Python’s powerful built-in data structures like lists and dictionaries.

Happy coding!

Thanks for visiting
We are actively updating content to this site. Thanks for visiting! Please bookmark this page and visit again soon.
Sponsor