Python

Dictionary

Në shqip: Fjalor

ShpjegimiSQ

Fjalori (dictionary) në Python ruan çifte çelës–vlerë brenda kllapave { }. Vlerën e gjen shpejt sipas çelësit, jo sipas pozicionit — njësoj si objekti në JavaScript.

EnglishEN

A dictionary in Python stores key–value pairs inside curly braces { }. You find a value quickly by its key, not by its position — just like an object in JavaScript.

Si ta mendosh

Si një fjalor i vërtetë: kërkon fjalën (çelësin) dhe gjen shpjegimin (vlerën). Nuk të duhet ta dish në cilën faqe është.

Lexoje në anglisht

Like a real dictionary: you look up the word (the key) and find its meaning (the value). You don't need to know which page it's on.

Shembull kodipython

notat = {"Arta": 9, "Besnik": 8}
notat["Dua"] = 10
print(notat["Arta"])  # 9

Terma të lidhur