Level 9 : What is the output of this code?


x = 3
while x > 0:
    print(x)
    x -= 1

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