Level 5 : What will be the output of the following Python code?


def fun(n):
    if (n > 100):
        return n - 5
    return fun(fun(n+11));
 
print(fun(45))

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