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