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