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