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