Open In App
Related Articles

Python-Quizzes | Python Dictionary Quiz | Question 16

Improve Article
Improve
Save Article
Save
Like Article
Like

Question 16:Find the output of the following program:




numberGames = {} 
numberGames[(1,2,4)] = 8
numberGames[(4,2,1)] = 10
numberGames[(1,2)] = 12
  
sum = 0
for k in numberGames: 
    sum += numberGames[k] 
  
print (len(numberGames) + sum)


(A) 33
(B) 12
(C) 10
(D) 8


Answer: (A)

Explanation: Tuples can be used for keys into dictionary. The tuples can have mixed length and the order of the items in the tuple is considered when comparing the equality of the keys.

Quiz of this Question

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 17 Sep, 2020
Like Article
Save Article
Previous
Next
Similar Reads