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