Level 1 : What will be the output of the following code snippet?


a = [1, 2, 3]
a = tuple(a)
a[0] = 2
print(a)

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