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