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