Загрузка...

1 Aur 1.0 Same Key Kaise? 😳🔥| Python Dict Trap #shorts #pythonchallenge#pythontricks #pythonsoftware

💡 Python Trick Question

What will be the output of this code? 😳👇

d = {}

d[1] = "int"
d[1.0] = "float"

print(d)

⏳ Try to answer before checking!

👇 ✅ Solution:
In Python, 1 and 1.0 are considered equal.
So the second value overwrites the first one.

👉 Output:
{1: 'float'}

🔥 Important concept: dictionary key equality

💬 Comment your answer before checking!

🚀 Follow for daily Python tricks

#python #coding #programming #shorts #learnpython #pythonchallenge #pythontricks #pythonsoftware

Видео 1 Aur 1.0 Same Key Kaise? 😳🔥| Python Dict Trap #shorts #pythonchallenge#pythontricks #pythonsoftware канала CodeSpark_hub
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять