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