Computer Science
Identify the valid declaration of L:
L = {1: 'Mon', 2 : '23', 3: 'hello', 4: '60.5'}
- dictionary
- string
- tuple
- list
Answer
dictionary
Reason — The given declaration L = {1: 'Mon', 2: '23', 3: 'hello', 4: '60.5'}
creates a dictionary in Python. Dictionaries are created using curly braces {}, and keys are separated from their corresponding values by a colon (:). Each key-value pair is separated by a comma (,) within the dictionary.
Related Questions
Which is the correct form of declaration of dictionary ?
- Day = {1:'Monday', 2:'Tuesday', 3:'wednesday'}
- Day = {1;'Monday', 2;'Tuesday', 3;'wednesday'}
- Day = [1:'Monday', 2:'Tuesday', 3:'wednesday']
- Day = {1'monday', 2'tuesday', 3'wednesday'}
Identify the valid declaration of L:
L = [1, 23, 'hi', 6]
- list
- dictionary
- array
- tuple
Which value type does input() return ?
- Boolean
- String
- Int
- Float
Which of the following is a valid relational operator in Python ?
- +
- **
- >
- and