What Will Be The Output Of The Following Python Codep Pre #588
What will be the output of the following Python code?</p> <pre><code class="language-python"> count={} count[(1,2,4)] = 5 count[(4,2,1)] = 7 count[(1,2)] = 6 count[(4,2,1)] = 2 tot = 0 for i in count: tot=tot+count[i] print(len(count)+tot) </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs109 Python. It can also be found in gs gs109 Python Dictionary - Python Dictionary - Quiz No.5.
What will be the output of the following Python code?
count={} count[(1,2,4)] = 5 count[(4,2,1)] = 7 count[(1,2)] = 6 count[(4,2,1)] = 2 tot = 0 for i in count: tot=tot+count[i] print(len(count)+tot)
25
17
16
Tuples can’t be made keys of a dictionary