Python Day-9 Mathematical Operations & Dictionaries in Python - Explained with Examples

Поделиться
HTML-код
  • Опубликовано: 5 фев 2025
  • 📌 In this video, we’ll explore:
    1️⃣ Basic and advanced mathematical operations in Python.
    2️⃣ A deep dive into Python dictionaries, their structure, and how to use them.
    3️⃣ Hands-on examples for better understanding.
    📗 Topics Covered:
    ✅ Addition, subtraction, multiplication, and division in Python.
    ✅ Modulus, exponentiation, and floor division.
    ✅ How to create, update, and access dictionaries.
    ✅ Practical examples of using dictionaries in Python programs.
    🚀 By the end of this video, you’ll be able to:
    Perform complex calculations using Python.
    Work confidently with Python dictionaries.
    🔗 Don't forget to like 👍, share 🔄, and subscribe 🔔 for more Python tutorials!
    Examples of Mathematical Operations
    Basic Arithmetic:
    python
    Copy code
    Addition, Subtraction, Multiplication, Division
    a = 10
    b = 5
    print("Addition:", a + b)
    print("Subtraction:", a - b)
    print("Multiplication:", a * b)
    print("Division:", a / b)
    Modulus and Floor Division:
    python
    Copy code
    Modulus and Floor Division
    x = 15
    y = 4
    print("Modulus:", x % y) # Remainder of division
    print("Floor Division:", x // y) # Rounds down to nearest integer
    Exponentiation:
    python
    Copy code
    Exponentiation
    base = 2
    power = 3
    print("Exponentiation:", base ** power)
    Using Math Library:
    python
    Copy code
    import math
    Square root and rounding
    num = 16
    print("Square Root:", math.sqrt(num))
    print("Rounded Value:", round(4.567, 2))
    Combining Operations:
    python
    Copy code
    Combination of operations
    result = (10 + 2) * 3 / 2 - 4
    print("Combined Result:", result)
    Examples of Dictionaries
    Creating a Dictionary:
    python
    Copy code
    Define a dictionary
    person = {"name": "Alice", "age": 25, "city": "New York"}
    print(person)
    Accessing Values:
    python
    Copy code
    Access values by key
    print("Name:", person["name"])
    print("Age:", person["age"])
    Updating and Adding Elements:
    python
    Copy code
    Update existing key and add new key
    person["age"] = 26
    person["profession"] = "Engineer"
    print(person)
    Removing Elements:
    python
    Copy code
    Remove an element using pop
    person.pop("city")
    print(person)
    Iterating Through a Dictionary:
    python
    Copy code
    Loop through keys and values
    for key, value in person.items():
    print(key, ":", value)

Комментарии • 1

  • @MarkEdwards-p3i
    @MarkEdwards-p3i 2 месяца назад +1

    Appreciate the detailed breakdown! A bit off-topic, but I wanted to ask: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). How can I transfer them to Binance?