Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3
- def multiple(number, factor):
- if number == 0:
- return factor
- if factor == 0:
- return 0
- if number == factor:
- return number
- if number < factor:
- return factor
- if number > factor:
- return (number + factor - 1) // factor * factor
- # [multiple(i, j) for i in range(1000) for j in range(1000)]
- # 1000004 function calls in 0.965 seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement