HTML

    Select a Subtopic

    Python Learning Journey πŸš€

    βœ… Day 1: Introduction to Python

    Let’s dive into Day 1 with practical explanations, code snippets, and exercises!

    🧠 What is Python? Why use it?

    • Python is a high-level, interpreted, and versatile programming language.
    • It’s known for its simple syntax and wide range of use cases like Web Development, Data Science, Machine Learning, Automation, and Scripting.
    • Why Learn Python? Easy to learn for beginners, huge community support, and tons of libraries and frameworks.

    πŸ›  Setting Up Your Python Environment

    • Download and install Python from https://www.python.org/downloads/
    • Verify the installation by running the command `python --version` in the terminal.
    • Install a Code Editor: Use VS Code or PyCharm for a better coding experience.

    ▢️ Running Python Scripts

    • Interactive Mode: Open your terminal and type `python`.
    • Script Mode: Create a file with the `.py` extension (e.g., `hello.py`) and run it using `python hello.py`.

    πŸ“ Python Syntax, Indentation, and Comments

    • Python uses indentation to define code blocks.
    • Use `#` to add comments.
    # This is a comment print("Hello, World!") # This will print Hello, World!

    πŸ“¦ Variables and Data Types

    • Variables store data. No need to declare the type in Python.
    • Common data types: int, float, str, and bool.
    name = "John" # String age = 25 # Integer is_student = True # Boolean

    πŸ“₯ Input and Output

    • Use `input()` to take input from the user and `print()` to display output.
    name = input("Enter your name: ") print("Hello, " + name + "!")

    πŸ’» Exercises for Day 1

    Exercise 1: Simple Input/Output

    # Solution name = input("Enter your name: ") age = int(input("Enter your age: ")) print(f"Hello {name}, you are {age} years old!")

    Exercise 2: Data Type Practice

    # Solution name = "Alice" age = 30 salary = 50000.50 is_married = False print(name, type(name)) print(age, type(age)) print(salary, type(salary)) print(is_married, type(is_married))

    Exercise 3: Calculator (Optional Challenge)

    # Solution num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) sum = num1 + num2 print(f"The sum of {num1} and {num2} is {sum}")

    Ready to dive into Day 2? Let's go! πŸš€