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


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

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