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


i = 0
while i < 3:
    print(i)
    i += 1
else:
    print(0)

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