Download presentation
Presentation is loading. Please wait.
Published byAlexis Allen Modified over 8 years ago
1
Find LCM Least Common Multiple of 3 and 5: List the Multiples of each number, The multiples of 3 are 3, 6, 9, 12, 15, 18,... etc The multiples of 5 are 5, 10, 15, 20, 25,... etc
2
Find LCM def lcm(x, y): if x > y: greater = x else: greater = y while(True): if((greater % x == 0) and (greater % y == 0)): lcm = greater break greater += 1 return lcm
3
Find GCD Factors of 12 are 1, 2, 3, 4, 6 and 12 Factors of 30 are 1, 2, 3, 5, 6, 10, 15 and 30 Example: Factors of 12 and 30
4
Find GCD def gcd(x, y): if x > y: smaller = y else: smaller = x for i in range(1,smaller + 1): if((x % i == 0) and (y % i == 0)): gcd= i return gcd
5
Python’s Built-In Function Abs -- Find absolute value abs(-10) float, convert a string or a number to floating number int len - returns the length of an object max, min Range Sum: sum(list(range(0,5))
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.