# How to use is_multiple_of method in assertpy

Best Python code snippet using assertpy_python

fizzbuzz.py

Source:fizzbuzz.py

`1import sys2def is_multiple_of(a: int, b: int):3 """Check if a is a multiple of b"""4 return a % b == 05def fizzbuzz(array_size, fizz, buzz):6 """7 Print 'Fizz' if multiple of fizz variable, 'Buzz' if multiple of8 buzz variable and 'FizzBuzz' if multiple of both.9 """10 for i in range(1, array_size+1):11 value_to_print = i12 if is_multiple_of(i, fizz) and is_multiple_of(i, buzz):13 value_to_print = "FizzBuzz"14 elif is_multiple_of(i, fizz):15 value_to_print = "Fizz"16 elif is_multiple_of(i, buzz):17 value_to_print = "Buzz"18 print(value_to_print)19if __name__ == '__main__':20 arguments = sys.argv[1:]21 try:22 parameters = [int(x) for x in arguments]23 except ValueError:24 raise ValueError("Apenas valores inteiros sÃ£o aceitos.")25 integers_array_size = parameters[0]26 fizz = parameters[1]27 buzz = parameters[2]28 if integers_array_size < 2:29 raise ValueError("O tamanho da lista deve ser maior que 1.")30 fizzbuzz(integers_array_size, fizz, buzz)`

main.py

Source:main.py

`...3If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.4Find the sum of all the multiples of 3 or 5 below 1000.5"""6N = 10007def is_multiple_of(left, right):8 return right % left == 0 or left % right == 09if __name__ == "__main__":10 summed = 011 for i in range(2, N):12 if is_multiple_of(i, 3) or is_multiple_of(i, 5):13 summed += i...`

sum_of_multiples.py

Source:sum_of_multiples.py

`1def sum_of_multiples(limit, multiples):2 multiples = [n for n in range(1, limit) if is_multiple_of(n, multiples)]3 return sum(multiples)4def is_multiple_of(n, multiples):5 for m in multiples:6 if n % m == 0:7 return True...`

## Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.