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


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

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