Level 10 : What will the following code produce?


from collections import Counter
data = [1, 2, 2, 3, 3, 3]
counter = Counter(data)
print(counter.most_common(2))

Author: VenuEmmela | Tags: collections | 1859+ Python FAQs | Share
oops | input-function | installation | attribute | global-variable | file_handling | floats | __all__-attribute | scientific-notation | regular-expressions | default-mutable-argument | counter-function | class | sum-function | function-and-scope | conditional-statement | syntax-error | statement | logical-operators | global | sets | dictionary-comprehensions | list-comprehension | function-argument | min-max-function | string-slicing | global-variable | __future__ | staticmethod | list-method | string-concatenation | return-statement | enumerate() | creating-custom-modules | choice | conversion | built-in | lambdas | counter | syntax | logical-operator | decorator | dictionaries | software-design | split | handling-missing-values-(fillna,-dropna) | objects | join | operator-overloading | def | generators | strings | comprehension | invalid-list | mapping-function | recurssion | id-function | indexing:-loc-vs-iloc | conditional-statements | loop | input-function | recursion | name-mangling | regex | data-type-conversions | list-indexing | implementation | namespace | dataframe-and-series-objects | nested-loop | control-statement | constructor | list-join | sum() | opening-files-(open()) | matplotlib | sorted | print | condition | string-method | formal-and-actual-parameter | swapping | string-slicing | python-django | string-iteration | asyncio | set-operation | string-method | arithmetic-operation | python-syntax-and-structure | list-mutation | key-value-pairs | reading:-read(),-readline(),-readlines() | package-management | sys-module | list-methods-and-slicing | string-formatting | loop-control-statements | integers | math-copysign | module | higher-order-function | version | init | datetime.date,-datetime.time,-datetime.datetime | descriptors | threading | magic-method | exception-handling | access-modifier | boolean-and-non-boolean | multithreading | loops | multiprocessing | numpy | bitwise-operator | conditional-statement | iterator | head-and-tail | precedence-and-associativity | while-loop | data-structures-in-python | collection | floating-point-precision | oop | thread-safe-data-structures-(queue.queue) | set | dictionary | immutability | raise-statement | complex-number | dictionary-methods | boolean-masking | binary | class-and-instance-variable | error-handling | file-handling | overriding-methods | reading-and-writing-files | namedtuple | while-loops | identity-operator | design-principle | input | odd-number | datetime | single-inheritance | generators-in-python | file | filter-function | exception | string-manipulation | for | zip | error | regular-expression | mysql | introduction-to-python | data-structures | anchors-(^,-$) | __init_subclass__ | data_structure | heap-memory | operator | sorting | identity-operators-(is,-is-not) | quantifiers-(*,-+,-?,-{}) | basic | built-in-function | pseudocode | range | multiple-inheritance | round | mathematics | sys | arithmetic-expression | docstring | data-types | goto-function | thread-synchronization | string-methods | managing-directories-with-os-and-shutil | import-method | operations | type_conversion | reading-and-writing-large-files-efficiently | dicts | matrix | object-attribute | default-arguments | random-function | directory-operations | benefit | working-with-dates-and-times | operand | time-series-with-pandas | inherit | context-manager | multiple-except-blocks | thread | stack | list-vs-tuple | using-join()-and-is_alive()-methods | boolean | identifier | fabs-function | identity-operator | assert | introduction-to-threads | operator-or | type-conversion-and-casting | method-overloading | round-function | tuples | file-handling | copy | string | comparison | append | pass | decimal | using-map()-for-transformations | test-discovery | why-use-multiprocessing-over-threading?-(gil) | function | python_version | python-operators | generator | error-handling | data-structure | working-with-binary-files-(rb,-wb) | global-keyword | deep-copy | creating-and-starting-threads | tuple-methods | parsing-with-strptime | indexing | yield | polymorphism | exponentiation | syntaxerror | list-comprehensions | slice | slicing | control-flow | functional-programming | advanced-file-operations | rollback | built-in-modules | syntax-error | control-flow | numeric | string-formatting | pickling--unpickling | static-method | list-operation | unit-testing | print-statement | class-and-object | booleans | command-line-parsing | introduction-to-multiprocessing | python | intering | library | int | collections | interpreter | inheritance | operators | math | defining-functions | operator-and | shallow-copy | exception-handling | filter | built-in-function | membership-operators-(in,-not-in) | zip-function | assignment-operator | class-and-inheritance | with-statement | parameter | aggregating-data-with-functools.reduce() | escape-operator | python-history | immutable-data-type | python-repl | typeerror | walking-through-directories-using-os.walk() | loop-control | classes | else | raise | memory-management | mutable | formatting-with-strftime | functional-programming | keyword | precedence | virtual-environment | overflow | asyncio-module | complex | list | iterators | destructor | indentation | data-type | pandas | multiple-inheritance | random | array | list-slicing | assignment-operators | data-type | match | using-yield-in-functions | tuple | pep | integer | binary-operation | functions | working-with-file-paths | joining-and-merging-dataframes | application | tuple-unpacking | logical-operation | postfix | update | center | lists | debugging | while-else-loop | lambda | expression | python-module | methods | using-assertions-(assertequal,-assertraises) | frozenset | writing:-write(),-writelines() | min-function | memory | filtering-and-indexing | working-with-temporary-files-using-tempfile | using-lists-as-stacks | else-statement | difference-between-threads-and-processes | factorial-function | zfill-function | mathematical-function | turtle | feature | type-conversion | touples | compute | max-min | expand-tab | comment | type-conversion | data-structure | while-and-for-loop | lambda-function | lambda-functions | using-os-and-pathlib-modules | bitwise-operator | using-the-threading-module | gil | datatype | format | list-comprehension | map-function | list,-set,-and-dictionary-comprehensions | encapsulation | using-else-and-finally | call | literal-characters-and-special-characters | method | virtual-environment | variable | logical-operator | iterable | async | arbitrary-arguments-(*args,-**kwargs) | version-check | bitwise | matrix-list-comprehension | encoding | class-decorators | sorting-and-ranking ...