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