Easy Python Tutorial - Dictionary ( Episode - 10 )

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

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

  • @Y2kDevHub
    @Y2kDevHub  14 дней назад

    # Dictionary = {} is a collection of key-value pairs.
    # Dictionary က Set နှင့်ဆင်တူပါတယ်။
    cars = {
    "Ford": "Mustang",
    "Chevy": "Camaro",
    "Dodge": "Charger",
    "Toyota": "Corolla"
    }
    print(cars)
    print(dir(cars))
    cars.pop("Ford")
    print(cars)
    cars.popitem()
    print(cars)
    cars.update({"Mazada": "RX-7"})
    print(cars)
    if cars.get("BMW"):
    print("Yes")
    else:
    print("No")
    for key in cars.keys():
    print(key)
    for value in cars.values():
    print(value)
    # items method က Dictionary အတွက် key-value pairs ကို tuple အဖြစ်ပြောင်းပေးပါတယ်။
    item = cars.items()
    print(item)
    for keys, values in cars.items():
    print(f"{keys}: {values}")
    for car in cars:
    print(f"{car}: {cars[car]}")