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