Level 10 : What will be the output?


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

print(func())
print(func())

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