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