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