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