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