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