Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- arr = [1, 2, 3, 4, 5]
- k = int(input('int k: '))
- matched = []
- all_combinations = itertools.combinations(arr, 2)
- for combination in all_combinations:
- if not sum(combination) % k:
- matched.append(combination)
- print(matched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement