Level 1 : What will be the output of the following Python code snippet?


test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))

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