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