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


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

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