Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_list = [int(i) for i in input().split(' ')] # get items from input with spaces between
- def find_integer_with_most_divisors(input_list):
- num, div = 0, 0 # tmp
- for item in my_list: # iterate list
- div_count = 0
- for i in range(1, item + 1): # genrate numbers
- if item % i == 0: # check divisor
- div_count += 1
- if div_count > div:
- num, div = item, div_count
- # print(num, div)
- return num
- num = find_integer_with_most_divisors(my_list)
- print(num)
- # there might be better solutions. this one just pop in my mind.
Add Comment
Please, Sign In to add comment