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