Write the function named okek that finds and returns the OKEK (Smallest of Common Multiple) values of two positive integers sent to it according to the method given, in accordance with the example program below. -The OKEK value of the two numbers given is equal to their product divided by the GCD (Largest Middle Divisor) value. OKEK (x, y) = (x. Y) / GCD (x, y) GCD is found as follows: -If the two numbers given are equal, GCD of these two numbers is equal to themselves. (So if x = y GCD (x, y) = x) -If the two numbers given are different, the GCD of these two numbers is equal to the GCD of the number obtained from the difference between small and large and small. (That is, GCD (x, y) = GCD (xy, y) if x> y, and GCD (x, y) = GCD (x, yx) if y> x). continued until the result can be found from the first rule.) Sample : OKEK (24, 32) =? GCD (24, 32) = GCD (24, 32-24) = GCD (24-8, 8) = GCD (16-8, 8) = GCD (8, 8) = 8 OKEK (24, 32) = (24.32) / GCD (24, 32) = 768/8 = 96
Step by stepSolved in 2 steps with 1 images
- 5. Write a function harmonic that will take an integer n as a parameter and return the result of the harmonic series: Γράψτε μια συνάρτηση harmonic που θα πάρει έναν ακέραιο η ως παράμετρο και θα επιστρέψει το αποτέλεσμα της αρμονικής σειράς: 1 1 -+-+-+ 3 + 2 For example, harmonic (2) = 1.5 and harmonic (3) = 1.833arrow_forward-Python- Write a function get_letter_grade, such that when given * a lab grade score and * a list of the grade cutoffsreturns the letter grade of that score.Note: Your function automatically returns A for the values that are >= to the first cutoff-value in the list, then A- for the second cutoff-value, B+ for the third and so on. The function returns None for anything that's below the score for B-. You test that get_letter_grade(97, [93, 90, 87, 83, 80]) correctly returns an A, and get_letter_grade(93, [97, 90, 87, 83, 80]) returns A-. DO NOT hard-code the cutoffs, since they can change! You can copy/paste the following template: def get_letter_grade(score, cutoffs): if score ... : return 'A' ...: return 'A-' ...: return 'B+' ...: return 'B' ...: return 'B-'arrow_forwardWrite a function “gcDivisor” that takes two positive int “k” and “m” and returns the greatest common divisor of these two positive integers. Using recusion in python3.arrow_forward
- Re-write the following function so that a given XAND return the value of f(x).arrow_forwardwrite a function on_orangeline(station) that returns True if the station is on the Orange Line use pythonarrow_forwardWrite a function in Python called calc_length that takes two arguments, the length of the string L and the temperature T. This function should compute the new length of the string, taking into account the thermal expansion of the string relative to 20 degress (C). That new length should be returned from the function when it is called.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY