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


x = 'abcd'
for i in range(len(x)) :
    print(i)

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