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


for i in range(5):
    print(i)

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