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