Level 1 : What will be printed by this code?


d = {'x': 10}
d['y'] = d.get('y', []) + [20]
print(d)

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