Level 1 : What does the following code output?


def func(x, lst=[]):
    lst.append(x)
    return lst

print(func(10))
print(func(20, []))
print(func(30))

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