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