Level 10 : What is the output of the following code?


str = 'surya'
for i in range(len(str)):
    print(i)

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