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