Level 5 : What will be the output of the following code snippet?


def countdown(n):
    if n <= 0:
        print("Done!")
    else:
        print(n)
        countdown(n - 1)

countdown(3)

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