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