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