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