What will be the output of the following Python code?
a={5,6,7,8} b={7,8,9,10} print(len(a+b))
8
Error, unsupported operand ‘+’ for sets
6
Nothing is displayed
What will the output of following code?
a={1,2,3} b={1,2,3,4} c=a.issuperset(b) print(c)
False
True
Syntax error for issuperset() method
Error, no method called issuperset() exists
keys, keys
key values, keys
keys, key values
key values, key values
s={abs}
s={4, ‘abc’, (1,2)}
s={2, 2.2, 3, ‘xyz’}
s={san}
pop
remove
update
sum
x | y
x ^ y
x & y
x – y
discard
dispose
s2.issubset(s1)
s2.issuperset(s1)
s1.issuperset(s2)
s1.isset(s2)
d = {}
d = {“john”:40, “peter”:45}
d = {40:”john”, 45:”peter”}
All of the mentioned
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45} print("john" in d)
None
Error
d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} print(d1 == d2)
d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} print(d1 > d2)
d = {"john":40, "peter":45} print(d["john"])
40
45
“john”
“peter”
d.delete(“john”:40)
d.delete(“john”)
del d[“john”]
del d(“john”:40)
d.size()
len(d)
size(d)
d.len()
d = {"john":40, "peter":45} print(list(d.keys()))
[“john”, “peter”]
[“john”:40, “peter”:45]
(“john”, “peter”)
(“john”:40, “peter”:45)
Since “susan” is not a value in the set, Python raises a KeyError exception
It is executed fine and no exception is raised, and it returns None
Since “susan” is not a key in the set, Python raises a KeyError exception
Since “susan” is not a key in the set, Python raises a syntax error
The values of a dictionary can be accessed using keys
The keys of a dictionary can be accessed using values
Dictionaries aren’t ordered
Dictionaries are mutable
{1: ‘A’, 2: ‘B’}
dict([[1,”A”],[2,”B”]])
{1,”A”,2”B”}
{ }
a={1:"A",2:"B",3:"C"} for i,j in a.items(): print(i,j,end=" ")
1 A 2 B 3 C
1 2 3
A B C
1:”A” 2:”B” 3:”C”