Level 1 : What will be printed by this code?


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

Author: SandhyaR | Tags: dictionary | 1736+ Python FAQs | Share
command-line-parsing | multithreading | regular-expression | mapping-function | loop | factorial-function | parameter | list-method | format | string-iteration | frozenset | heap-memory | default-mutable-argument | global-variable | data-structure | immutability | sum() | syntax-error | list-comprehension | datetime | numeric | pep | list-operation | python-repl | exception-handling | identity-operator | asyncio | string-manipulation | while-else-loop | scientific-notation | design-principle | function-argument | bitwise | bitwise-operator | global-variable | python_version | fabs-function | overflow | dictionaries | __init_subclass__ | destructor | type_conversion | mysql | identifier | copy | escape-operator | generators | encoding | class-and-inheritance | docstring | lambdas | map-function | list-comprehension | odd-number | exception-handling | random | complex | assignment-operator | async | module | assert | basic | collection | print | counter | syntax | id-function | context-manager | string-method | operator | generator | update | implementation | with-statement | while-loop | zip-function | list | global-keyword | input | feature | enumerate() | magic-method | oop | match | else-statement | control-flow | invalid-list | filter | iterator | typeerror | touples | functions | list-mutation | method | boolean-and-non-boolean | name-mangling | min-max-function | inheritance | mutable | recurssion | attribute | matrix | numpy | set-operation | binary | loop-control | debugging | loops | def | virtual-environment | __future__ | global | indexing | bitwise-operator | asyncio-module | zfill-function | classes | sys-module | sys | lists | slice | error | benefit | swapping | arithmetic-operation | namedtuple | threading | condition | init | syntaxerror | set | pandas | min-function | recursion | print-statement | library | operations | precedence-and-associativity | postfix | filter-function | function-and-scope | sorting | counter-function | polymorphism | access-modifier | control-flow | yield | mathematical-function | tuple | random-function | python-history | max-min | collections | keyword | round-function | python-module | matrix-list-comprehension | list-indexing | gil | generators-in-python | descriptors | logical-operator | data-type | binary-operation | file | __all__-attribute | input-function | built-in-function | math-copysign | regex | string-formatting | file-handling | version | formal-and-actual-parameter | logical-operator | int | zip | objects | raise | indentation | application | data-structure | python-django | append | join | for | integer | compute | comparison | matplotlib | turtle | list-join | string-slicing | choice | built-in-function | memory-management | head-and-tail | center | software-design | string-method | higher-order-function | comprehension | comment | staticmethod | operator-and | control-statement | error-handling | object-attribute | encapsulation | operators | conditional-statement | installation | array | version-check | built-in | decimal | string-concatenation | exponentiation | type-conversion | class-and-object | dicts | operator-overloading | oops | constructor | list-slicing | exception | syntax-error | dictionary | conversion | package-management | statement | functional-programming | inherit | immutable-data-type | class-and-instance-variable | multiple-inheritance | deep-copy | complex-number | function | list-vs-tuple | precedence | decorator | sum-function | sorted | nested-loop | lambda | methods | lambda-function | pickling-&-unpickling | tuple-unpacking | python | return-statement | string-slicing | variable | class | call | data-structures | string-formatting | shallow-copy | mathematics | rollback | datatype | slicing | memory | identity-operator | expand-tab | type-conversion | round | math | logical-operation | file_handling | operator-or | data_structure | virtual-environment | while-and-for-loop | conditional-statement | operand | namespace | iterable | expression | split | floating-point-precision | boolean | arithmetic-expression | thread | interpreter | static-method | input-function | multiprocessing | stack | range | file-handling | goto-function | string | data-type | pseudocode | import-method ...