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