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