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