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