Programming Essentials

2 min read

Master the Foundation with Real-World Practice

Python is one of the easiest and most powerful programming languages used todayโ€”from data science to automation, it’s everywhere. Whether you’re a beginner or brushing up your knowledge, this guide walks you through the core essentials of Python with practical examples and a real-world project.


1. ๐Ÿง Variables & Data Types #

Variables are containers used to store data. You donโ€™t need to declare a type explicitly in Pythonโ€”it figures it out for you!

Common Data Types: #

TypeExampleDescription
intage = 25Whole numbers
floatpi = 3.14Decimal numbers
strname = "Hannan"Text or character sequences
boolis_valid = TrueBoolean values: True/False
complexz = 3 + 2jComplex numbers (used in scientific computing)
# Example
age = 25
height = 5.9
name = "Hannan"
is_student = True
z = 3 + 2j

2. ๐Ÿ”„ Type Conversion & Type Checking #

Python allows dynamic typing, but you can also explicitly convert between types.

๐Ÿ” Type Conversion: #

x = "10"
y = int(x)  # Convert string to int
z = float(y)  # Convert int to float

โœ… Type Checking: #

print(type(x))  # <class 'str'>
print(type(y))  # <class 'int'>

Use int(), float(), str(), bool() to convert between types.


3. ๐Ÿ“ฅ User Input & ๐Ÿ–จ Output Formatting #

Getting Input: #

name = input("Enter your name: ")
age = input("Enter your age: ")

Output Formatting: #

# Basic
print("Name:", name, "| Age:", age)

# Advanced - f-string
print(f"Hello, {name}! You are {age} years old.")

f-strings make formatting easy and readable.


4. โž• Operators in Python #

๐Ÿงฎ Arithmetic Operators #

SymbolMeaningExample
+Addition5 + 2
-Subtraction5 - 2
*Multiply5 * 2
/Divide5 / 2
//Floor divide5 // 2
%Modulus5 % 2
**Power5 ** 2

๐Ÿ†š Comparison Operators #

Used to compare values. Returns a boolean.

5 > 3   # True
5 == 5  # True
5 != 3  # True

โš™ Logical Operators #

Combine multiple conditions.

x = 10
print(x > 5 and x < 20)  # True
print(not x == 10)       # False

๐Ÿ–Š Assignment Operators #

Assign values to variables.

x = 5
x += 2  # x = x + 2 โ†’ x becomes 7

5. โœ‚ String Manipulation #

Python treats strings as sequences of characters. Letโ€™s look at the most used string methods:

๐Ÿ“Œ Common Methods: #

text = "hello python"

print(text.upper())      # HELLO PYTHON
print(text.capitalize()) # Hello python
print(text.replace("python", "world")) # hello world
print(text.split())      # ['hello', 'python']

๐Ÿ” Concatenation & Formatting #

first = "Hannan"
last = "Hassan"
full_name = first + " " + last
print(f"My name is {full_name}")

๐Ÿ” Indexing and Slicing #

msg = "Hello World"
print(msg[0])     # H
print(msg[-1])    # d
print(msg[0:5])   # Hello

๐Ÿ›  Real-World Use Case: CLI Formatted Resume #

Letโ€™s create a basic command-line resume using Python that takes input and displays it in a nicely formatted structure.

โœ… Step-by-Step Code: #

print("===== CLI RESUME BUILDER =====")
print()

# Taking input from the user
name = input("Full Name: ")
email = input("Email: ")
phone = input("Phone Number: ")
summary = input("Professional Summary: ")
skills = input("Skills (comma-separated): ")
education = input("Highest Education: ")
experience = input("Most Recent Job Title: ")

# Formatting output
print("\n\n====== YOUR CLI RESUME ======\n")

print(f"๐Ÿ‘ค Name: {name}")
print(f"๐Ÿ“ง Email: {email}")
print(f"๐Ÿ“ฑ Phone: {phone}")
print("\n๐Ÿ“ Summary:")
print(f"{summary}")

print("\n๐Ÿ’ก Skills:")
for skill in skills.split(','):
    print(f" - {skill.strip()}")

print("\n๐ŸŽ“ Education:")
print(f"{education}")

print("\n๐Ÿ’ผ Experience:")
print(f"{experience}")

๐Ÿ”ง Sample Output: #

===== CLI RESUME BUILDER =====

Full Name: Abdul Hannan
Email: hannan@example.com
Phone Number: 0300-1234567
Professional Summary: Enthusiastic Python Developer with 2 years of experience.
Skills (comma-separated): Python, SQL, APEX, Git
Highest Education: BSc in Computer Science
Most Recent Job Title: Oracle APEX Developer

====== YOUR CLI RESUME ======

๐Ÿ‘ค Name: Abdul Hannan
๐Ÿ“ง Email: hannan@example.com
๐Ÿ“ฑ Phone: 0300-1234567

๐Ÿ“ Summary:
Enthusiastic Python Developer with 2 years of experience.

๐Ÿ’ก Skills:
 - Python
 - SQL
 - APEX
 - Git

๐ŸŽ“ Education:
BSc in Computer Science

๐Ÿ’ผ Experience:
Oracle APEX Developer

๐Ÿง  Wrap Up #

This article covered:

  • Variables and Data Types (like int, float, str, bool)
  • Type Conversion & Checking
  • User Input & Formatted Output
  • Operators (Arithmetic, Logical, Comparison, etc.)
  • String Manipulation
  • CLI Resume Builder โ€“ A real-world use case

โœ… Try It Yourself #

  • Add a save_to_file() feature to export the resume as .txt.
  • Use datetime to add current date or experience durations.
  • Convert the CLI to a GUI using libraries like tkinter.

Let me know if you want this as a downloadable PDF, or the next article in the Python tutorial series (like โ€œControl Flow in Pythonโ€ or โ€œFunctions & Loopsโ€).

Updated on June 9, 2025