Sharing notes from my ongoing learning journey — what I build, break and understand along the way.
Learning Python – Post 2: Using print(), Formatting Output, and Understanding Data Types
Learning Python – Post 2: Using print()
, Formatting Output, and Understanding Data Types
How to Open Jupyter Notebook (Quick Start)
Before we begin writing any Python code, make sure you can open Jupyter Notebook. Here’s how I do it step-by-step using Anaconda:
Open with Anaconda Navigator (GUI)
- Click Start on your computer (Windows).
- Search for Anaconda Navigator and open it.
- When it loads, find the Jupyter Notebook tile.
- Click Launch — it will automatically open in your browser.
Once it’s open:
- Navigate to the folder where you want to work.
- Click New > Python 3 (top right).
- A new notebook will open — ready for your Python code.
Let’s Begin Coding
In this post, I’m sharing what I learned during my first real coding session with Python. I started using the print()
function to display information, format output, and explore basic data types.
Let’s get into it.
Printing Numbers and Strings
The print()
function displays data in the console. You can use it with numbers, text (strings), or both.
print(42)
print(3.14)
Output:
42
3.14
Printing a string (a sequence of characters) requires quotes:
print("John")
Output:
John
Using Variables and Printing Results
You can store values in variables and perform calculations:
a = 5
b = 10
print(a + b)
Output:
15
Printing Multiple Items
You can print several items at once by separating them with commas. Python adds a space between each item by default:
print("Today is", "Monday")
print(100, 3.5, "Hello", "World")
Output:
Today is Monday
100 3.5 Hello World
String Formatting with sep
The sep
parameter controls what goes between printed items.
print("January", "February", "March", sep=" | ")
Output:
January | February | March
This is useful when printing values like dates:
print("08", "07", "2025", sep="/")
Output:
08/07/2025
Newlines and Tabs
Python supports escape characters like \n
(new line) and \t
(tab):
print("Hello\nHow are you?\nGoodbye")
Output:
Hello
How are you?
Goodbye
print("A\t\t\tB")
Output:
A B
Displaying Items on Separate Lines
You can use sep="\n"
to print items each on a new line:
print("Alice", "Bob", "Charlie", sep="\n")
Output:
Alice
Bob
Charlie
Checking Data Types with type()
The type()
function tells you what kind of value (data type) you’re working with.
type(34) # int → integer (whole number)
type(3.14) # float → decimal number
type("Python") # str → string
These are fundamental to understanding how Python treats different values.
Summary
In this lesson, I practiced:
- Using the
print()
function - Printing numbers, strings, and variables
- Formatting output using
sep
,\n
, and\t
- Using
type()
to inspect data types
This felt like a great first step — the basics may be simple, but they’re powerful. Clear output and clean formatting go a long way when building programs