ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(frozenset([1, 2]) == {1, 2}, {frozenset([1]): 'x'}[frozenset([1])])- A. False x
- B. True None
- C. False KeyError
- D. True x
Correct answer: D. True x
A frozenset compares equal to a set with the same elements, and it is hashable, so it can be a dict key that is looked up again.
More Python Programming questions
- What is printed? python a = [1, 2, 3] r = a.reverse() print(r, a)
- What is printed? python t = (1) u = (1,) print(type(t).name, type(u).name, len(u))
- What is printed? python try: print(1.0 // 0.0) except ZeroDivisionError as e: print(e)
- What is printed? python print(int('0x1A', 16), int('1A', 16), int('0x1A', 0))
- What is printed? python print(len(str(10 400 // 3)))
- What is printed? python print(1000000 == 10 6, 0x1F, 1e3 == 1000)