Sitemap

Basics of Python

2 min readAug 8, 2026

--

🐍 What is Python?

  • Python is a high-level, interpreted programming language.
  • It is widely used for web development, data science, AI/ML, and automation.
  • Its syntax is close to English, making it beginner-friendly.

βš™οΈ Setting Up Python

  • Download Python from the official site: python.org.
  • Install an IDE like PyCharm or use VS Code.
  • You can also use the built-in IDLE for quick practice.

πŸ“Š Basics

1. Variables and Data Types

name = "Joe"
age = 10
height = 5.6
is_student = True
  • String β†’ "Hello"
  • Integer β†’ 25
  • Float β†’ 5.6
  • Boolean β†’ True / False

Get Atmaja’s stories inΒ yourΒ inbox

Join Medium for free to get updates fromΒ thisΒ writer.

# String assignment
x = "India" # String

# Integer assignment
x = 15 # Integer
  • When you reassign x, its type changes automatically β€” Python is dynamically typed.

2. Operators

print(2 + 3)   # Addition
print(10 / 2) # Division
print(5 ** 2) # Power

3. Control Flow

if age > 18:
print("Adult")
else:
print("Minor")

4. Loops

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

5. Functions

def greet(name):
return f"Hello, {name}!"

print(greet("Joe"))

6. Lists

# Using square brackets
fruits = ["apple", "banana", "cherry"]

# Using list() constructor
numbers = list((1, 2, 3, 4))

# With repeated elements
zeros = [0] * 5

7.Dictionaries

# Empty dictionary
my_dict = {}

# With values
student = {
"name": "Atmaja",
"age": 25,
"is_student": True
}

# Using dict() constructor
person = dict(name="John", age=30)

8.Tuples

# Empty tuple
empty_tuple = ()

# With values
numbers = (1, 2, 3)

# Mixed data types
person = ("Joe", 25, True)

# Single-element tuple (note the comma!)
single = (5,)

Happy Coding…

--

--

Atmaja
Atmaja

Written by Atmaja

Mobility enthusiast, versatile coder…