Level 5 : What is the output for the below code?


def modify_list(lst):
    lst = lst + [4]
    return lst

x = [1, 2, 3]
modify_list(x)
print(x)

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