YOUR FIRST PYTHON PROGRAM BEGINNER TO PROFESSIONAL

Journey from your very first Hello World script to robust, modular, object-oriented, and production-ready Python programs.

🚀 The Evolution of a Python Developer

Writing a Python program starts with simple, single-line instructions, but as your applications grow, you transition into writing modular functions, handling errors gracefully, structuring classes, and writing production-ready scripts with logging and command-line interfaces.

1. Beginner Level: The Classic "Hello, World!"
Your very first Python program uses the built-in print() function to output text to the console.
Python (hello.py)
# Level 1: Basic Output
print("Hello, World!")
print("Welcome to Python programming with Nikita Infotech!")
Output: Hello, World! Welcome to Python programming with Nikita Infotech!
2. Beginner Level: Interactive Greeting & Variables
Store user input in variables and use f-strings to display personalized messages.
Python (greeting.py)
# Level 2: Variables and User Input (Simulated)
username = "Nikita"
current_year = 2026
experience_years = 5

print(f"Developer: {username}")
print(f"Active Year: {current_year}")
print(f"Professional Experience: {experience_years} years")
Output: Developer: Nikita Active Year: 2026 Professional Experience: 5 years
3. Beginner Level: Simple Retail Bill Calculator
Perform basic arithmetic operations to compute tax and final totals.
Python (calculator.py)
# Level 3: Basic Arithmetic Calculations
item_price = 1250
quantity = 3
tax_rate = 0.05

subtotal = item_price * quantity
tax_amount = subtotal * tax_rate
grand_total = subtotal + tax_amount

print(f"Subtotal: ₹{subtotal}")
print(f"GST Tax (5%): ₹{tax_amount}")
print(f"Grand Total Bill: ₹{grand_total}")
Output: Subtotal: ₹3750 GST Tax (5%): ₹187.5 Grand Total Bill: ₹3937.5
4. Intermediate Level: Encapsulating Logic in Functions
Organize code into reusable functions with parameters and return values.
Python (functions_app.py)
# Level 4: Modular Functions
def calculate_gst_bill(price, qty, tax=0.05):
    subtotal = price * qty
    total = subtotal + (subtotal * tax)
    return round(total, 2)

final_bill = calculate_gst_bill(price=1500, qty=2)
print("Calculated Bill via Function: ₹", final_bill)
Output: Calculated Bill via Function: ₹ 3150.0
5. Intermediate Level: Error Handling (Try-Except)
Write resilient code that catches runtime errors like division by zero or invalid input types.
Python (safe_calc.py)
# Level 5: Robust Error Handling
def safe_divide(numerator, denominator):
    try:
        result = numerator / denominator
        return result
    except ZeroDivisionError:
        return "Error: Division by zero is not allowed."
    except TypeError:
        return "Error: Invalid data types provided."

print("Result 10 / 2:", safe_divide(10, 2))
print("Result 10 / 0:", safe_divide(10, 0))
Output: Result 10 / 2: 5.0 Result 10 / 0: Error: Division by zero is not allowed.
6. Intermediate Level: File I/O & Text Logging
Interact with the operating system by creating, writing, and reading local text files.
Python (file_logger.py)
# Level 6: Writing logs to a file
log_filename = "system_activity.log"

# Writing log entry
with open(log_filename, "w") as file:
    file.write("INFO: System initialized successfully.\n")
    file.write("STATUS: Database connection active.\n")

# Reading log entry back
with open(log_filename, "r") as file:
    content = file.read()

print("File Contents Read Successfully:\n" + content)
Output: File Contents Read Successfully: INFO: System initialized successfully. STATUS: Database connection active.
7. Professional Level: Object-Oriented Programming (OOP)
Structure your application using classes, instance attributes, and methods following OOP principles.
Python (bank_account.py)
# Level 7: Object-Oriented Programming Class Structure
class BankAccount:
    def __init__(self, owner, initial_balance=0):
        self.owner = owner
        self.balance = initial_balance

    def deposit(self, amount):
        self.balance += amount
        return f"Deposited ₹{amount}. New Balance: ₹{self.balance}"

account = BankAccount("Nikita", 10000)
print(account.deposit(5000))
Output: Deposited ₹5000. New Balance: ₹15000
8. Professional Level: Enterprise Entry Point & Logging
Use if __name__ == "__main__": and Python's built-in logging module for enterprise-grade execution scripts.
Python (main_app.py)
import logging

# Configure enterprise logger
logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(asctime)s - %(message)s')

def main():
    logging.info("Starting enterprise microservice worker...")
    # Core application execution logic here
    logging.info("Worker task completed successfully.")

if __name__ == "__main__":
    main()
Output: [INFO] 2026-10-26 21:00:00,123 - Starting enterprise microservice worker... [INFO] 2026-10-26 21:00:00,125 - Worker task completed successfully.