Level 6 : What will be the output?


d = {1: 'A', 2: 'B'}
print(d.setdefault(3, 'C'))
print(d)

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