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