Question: Task 1: Write a function gcd(a, b) that takes two integers and uses the Euclidean algorithm to find their greatest common divisor. * INPUT: a

 Task 1: Write a function gcd(a, b) that takes two integers

Task 1: Write a function gcd(a, b) that takes two integers and uses the Euclidean algorithm to find their greatest common divisor. * INPUT: a - integer b integer * OUTPUT: the GCD as an integer In [ ]: def gcd(a, b): "returns the god of integers a and b INPUT: a, b - integers OUTPUT: the gcd as an int pass In [ ]: "TESTER CELL" print("Testing gcd(101, 4620) = ", gcd(101, 4620)) print("Expected: 1") print("Testing gcd (2349, 36) = ", gcd(2349, 36)) print("Expected: 9")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!