#python
#pythonprogramming
Python MCQ Questions and answers,
Python MCQ , Python Programming,
Python, Python Type,
dict, dictionary type, key-value pair
Python dictionary, Python dict
dict operation:
l = list(d)
→Pass a dictionary to the built-in list() constructor
⇒Returns a list l, of all the keys used in the dict d,
in their insertion order.
→Not values or key: value pairs.
dict creation
→Empty
1) {}⇔dict()
→Values
2) comma-separated list of
key: value pairs within {}
Also called mapping.
Ex:1
3) dict(**kwargs)
keys→valid identifiers
Ex:3
4) dict(mapping, /, **kwargs)
Ex:5,6
5) dict(iterable, /, **kwargs)
Each item in iterable must
be an iterable with exactly
two itms. Ex:7,8,9
6) dict comprehension
{x: x ** 2 for x in range(5)}
Features:
1. Comma-separated list of key:value pairs within braces {}.
2. Mutable object that preserve insertion order.
3. Keys must be hashable (immutable).
4. Keys allow mixed data type.
5. Values allow duplicates
6. Values can be of any data type.
Dictionary
Set of key: value pairs with unique keys.
If a key occurs more than once, the last value overwrites any previous value.
Hashable: int, float, str, tuple with immutable items, frozenset
Unhashable: list, set, dict
NIELIT M3-R5 Course 'O' Level Certification,
PG TRB,
TN TRB Assistant Professor Computer Science,
TN TRB AP Computer Science,
TRB AP,
GATE - Data Analytics, GATE - DA,
UGC NET, TANCET MCA, TN SET,
#pythondictionary
#pythontutorial #pythonforbeginners #pythonlists
#pythonlist #pythonhacks #pythondictionaries
#pythondeveloper #pythoncoding #learnpython
#pythonquiz #python3 #pythonskills #codingpython
#pythonbasics #pythonbeginner #pythonprogramming
#datascience #dataanalytics
#codingquiz #quizchallenge #codingcommunity
#freshers #techtalk #top10
#interviewpreparation #interviewhacks #interviewquestions #interviewskills
Ace your Python exams with this MCQ marathon!
Covers various Python concepts, including input/output, data structures, and more.
#PythonMCQs #PythonInterview #CodingQuiz #PythonProgramming #TechSkills
#ssitlecturestamil @ssitlecturestamilதமிழ்
d = {'a': 1, 'b': 2, 'c': 3}
l = list(d)
print(l)
⇒['a', 'b', 'c']
Информация по комментариям в разработке