Slicing
Concatenation
Deletion of elements
Iteration
keys()
getkeys()
allkeys()
keyvalues()
A collection of ordered and mutable data
A collection of unordered and mutable data with key-value pairs
A collection of immutable key-value pairs
A collection of values only
Returns None
Throws a KeyError
Creates a new key with a default value
Crashes the program
Clears all key-value pairs
Updates a specific key
Merges another dictionary into the current one
Removes all values
copy = list(original)
copy = original[:]
copy = original.copy()
All of the above
What is the output when we execute
list("hello") ?
['h', 'e', 'l', 'l', 'o']
[' hello']
['llo']
['olleh']
list
set
tuple
dictionary
Tuple
Integer
String
List
Dictionary
Set
{}
[]
<>
()
Appending
Deleting
What is the output of following code
x = [1, 2, 3] print(x[1:10])
Error
[2, 3]
[1, 2, 3]
a = "Python" print(a[-4:-1])
tho
yth
hon
thoN
x = [10, 20, 30] print(x * 0)
[0, 0, 0]
[ ]
0
x = "HELLO" print(x[1:-1])
ELL
ELLO
HELL
LL
d = {1:"A", 2:"B", 1:"C"} print(d)
{1:'A',2:'B'}
{1:'C',2:'B'}
{1:'A',1:'C',2:'B'}
d = {} d[1] = "Python" d[2] = "Java" print(len(d))
1
2
a = [1,2,3] del a[1] print(a)
[1,2,3]
[1,3]
[2,3]