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