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