Level 1 : What is the output of the below code?


def func(x):

    if(x==0 or x==1):

        return 1

    return func(x-1)*x

func(6)

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