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


a = [0, 1, 2, 3]
for a[0] in a:
    print(a[0])

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