Level 10 : What will be the output of the following code snippet?


def solve(a, b):
   return b if a == 0 else solve(b % a, a)
print(solve(20, 50))

Author: SandhyaR | Tags: recursion | 1736+ Python FAQs | Share
string-iteration | bitwise-operator | immutability | method | compute | shallow-copy | multithreading | tuple-unpacking | lambda | data-structure | string-formatting | context-manager | return-statement | namespace | import-method | list-join | class | variable | zip | exception-handling | bitwise-operator | keyword | type-conversion | mathematical-function | sum-function | def | copy | operator-and | expand-tab | matrix | for | file-handling | call | sorting | threading | gil | access-modifier | list-indexing | python_version | class-and-object | oops | descriptors | operator-or | string-formatting | update | file-handling | methods | feature | name-mangling | list | random | comment | postfix | floating-point-precision | data-structures | goto-function | collections | format | loop-control | python-history | virtual-environment | pickling-&-unpickling | syntax | staticmethod | memory | decorator | global | type-conversion | global-variable | file_handling | string-method | conditional-statement | touples | math | numpy | __future__ | swapping | decimal | indentation | list-method | parameter | arithmetic-expression | software-design | precedence | encapsulation | string-manipulation | identifier | control-flow | nested-loop | random-function | conditional-statement | int | destructor | iterable | syntax-error | init | stack | python-repl | bitwise | namedtuple | polymorphism | expression | oop | condition | data-structure | constructor | python-module | pep | conversion | string-concatenation | numeric | turtle | min-max-function | fabs-function | class-and-inheritance | list-slicing | scientific-notation | binary-operation | python | data-type | choice | join | list-comprehension | operand | sys | multiprocessing | list-vs-tuple | python-django | lambdas | error | loop | string | min-function | mapping-function | id-function | center | assignment-operator | string-slicing | asyncio-module | print-statement | version | design-principle | map-function | boolean | rollback | counter-function | datetime | factorial-function | file | operators | benefit | functions | immutable-data-type | array | global-keyword | sum() | collection | operations | logical-operator | thread | asyncio | list-comprehension | set-operation | classes | comprehension | formal-and-actual-parameter | counter | __init_subclass__ | default-mutable-argument | overflow | input | dictionary | slice | global-variable | enumerate() | round | lists | exception | function | tuple | basic | error-handling | math-copysign | filter-function | function-argument | library | multiple-inheritance | debugging | implementation | string-slicing | sys-module | assert | inheritance | identity-operator | recursion | else-statement | raise | virtual-environment | list-mutation | range | append | syntaxerror | while-else-loop | arithmetic-operation | type_conversion | dictionaries | filter | lambda-function | command-line-parsing | operator-overloading | mysql | identity-operator | interpreter | heap-memory | loops | frozenset | matrix-list-comprehension | syntax-error | datatype | built-in | mutable | yield | slicing | module | precedence-and-associativity | escape-operator | invalid-list | match | async | comparison | function-and-scope | complex | round-function | version-check | built-in-function | list-operation | docstring | objects | generators | while-and-for-loop | integer | boolean-and-non-boolean | max-min | magic-method | control-statement | data-type | generators-in-python | generator | operator | encoding | installation | head-and-tail | pseudocode | functional-programming | object-attribute | __all__-attribute | odd-number | string-method | mathematics | attribute | iterator | application | zip-function | higher-order-function | logical-operator | print | logical-operation | class-and-instance-variable | pandas | matplotlib | built-in-function | data_structure | while-loop | regex | deep-copy | indexing | recurssion | binary | typeerror | static-method | regular-expression | sorted | with-statement | exponentiation | split | statement | exception-handling | complex-number | set | control-flow | dicts | memory-management | zfill-function | input-function | package-management | input-function | inherit ...