Level 1 : what is the output for the below code


def f(x=[]):
    x.append(1)
    return x

print(f(), f())

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