Level 10 : What will be the output of the following Python program?


def foo(x):
    x[0] = ['def']
    x[1] = ['abc']
    return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))

Author: SandhyaR | Tags: memory-management | 1736+ Python FAQs | Share
binary-operation | error | int | recurssion | operations | static-method | print | identifier | type-conversion | random | string-iteration | asyncio | random-function | descriptors | list-comprehension | shallow-copy | syntax-error | string-method | compute | built-in | operator-overloading | keyword | built-in-function | global | comment | sys | file-handling | else-statement | sum() | global-variable | input-function | copy | set | string-method | scientific-notation | application | asyncio-module | type_conversion | docstring | exception | classes | multithreading | data_structure | expression | syntax | heap-memory | operator-and | datetime | match | pep | library | format | pandas | lambdas | object-attribute | regular-expression | list-comprehension | type-conversion | input | call | raise | immutability | pickling-&-unpickling | iterable | split | multiple-inheritance | context-manager | namespace | constructor | collection | global-keyword | head-and-tail | lambda | global-variable | numeric | frozenset | higher-order-function | syntax-error | parameter | software-design | string-formatting | slice | with-statement | module | touples | installation | python-django | counter-function | logical-operator | file_handling | operators | data-structures | bitwise-operator | zfill-function | control-statement | variable | mysql | binary | file-handling | python-history | namedtuple | feature | string-manipulation | destructor | attribute | list-method | pseudocode | while-and-for-loop | lists | escape-operator | functional-programming | comprehension | generators-in-python | bitwise-operator | default-mutable-argument | stack | fabs-function | min-function | threading | memory | indentation | data-structure | precedence-and-associativity | precedence | iterator | debugging | mutable | identity-operator | memory-management | async | staticmethod | init | choice | invalid-list | method | loops | condition | control-flow | string-concatenation | exception-handling | access-modifier | for | methods | function-and-scope | version | join | assert | python | turtle | min-max-function | dictionary | comparison | deep-copy | enumerate() | objects | virtual-environment | class-and-object | import-method | factorial-function | loop | oop | set-operation | range | conditional-statement | data-structure | logical-operation | arithmetic-operation | immutable-data-type | list | syntaxerror | return-statement | goto-function | collections | design-principle | dicts | indexing | inherit | string-slicing | __init_subclass__ | typeerror | input-function | __future__ | basic | tuple | sum-function | identity-operator | polymorphism | oops | boolean-and-non-boolean | complex-number | list-vs-tuple | list-operation | postfix | matplotlib | decorator | array | center | operand | bitwise | string | list-mutation | while-else-loop | formal-and-actual-parameter | list-join | swapping | class-and-instance-variable | thread | exception-handling | counter | virtual-environment | round | functions | lambda-function | string-formatting | conversion | list-indexing | math-copysign | magic-method | generators | dictionaries | zip | control-flow | complex | class-and-inheritance | function-argument | python_version | data-type | operator-or | regex | file | string-slicing | slicing | odd-number | while-loop | name-mangling | sorting | class | max-min | package-management | mapping-function | round-function | mathematical-function | floating-point-precision | operator | loop-control | assignment-operator | conditional-statement | sorted | python-module | numpy | matrix-list-comprehension | id-function | inheritance | filter | interpreter | recursion | __all__-attribute | encoding | filter-function | rollback | generator | error-handling | command-line-parsing | datatype | statement | integer | encapsulation | multiprocessing | exponentiation | implementation | gil | tuple-unpacking | decimal | benefit | sys-module | logical-operator | map-function | python-repl | version-check | zip-function | yield | data-type | update | print-statement | expand-tab | nested-loop | arithmetic-expression | mathematics | boolean | built-in-function | list-slicing | append | def | matrix | overflow | math | function ...