Level 9 : What will be the output of the following Python code?


def change(var, lst):
    var = 1
    lst[0] = 44
k = 3
a = [1, 2, 3]
change(k, a)
print(k)
print(a)

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