Python - Greatest Common Divisor W/ Recursion

preview_player
Показать описание
With the help of Euclid's algorithm, we create a GCD function recursively. GCD of 2 integers
Рекомендации по теме
Комментарии
Автор

Thumbs up for a great explanation of call stacks. I used to think recursion updated first func call, like this function would terminate because b == 0 as a result of recursion. Thanks man.

abdallahsiyabi
Автор

as a curiosity you can also write
def GCD(a, b):
return a if b==0 else GCD(b, a%b)

if anyone is obsessed with shortcode :))

kacpermokrzycki
Автор

Fantastic!! Of course I`ve learned something. What a lecture, man. Thanks a lot.

donpilarsuarezgudino
Автор

Thank you so much for explaining, this video helped me out alot.

dillic
welcome to shbcf.ru