number with the most prime divisors I've done a program and it works fine as I want to but I feel it could be better and more advanced so I want some master advice on my program which is going to take many numbers and return the number with the most prime divisors and the number of its divisors in front of the number like this 678 3 as the output
code :
list_of_inputs = []
for elements in range(5):
    list_of_inputs.append(int(input()))
list_of_inputs = list(set(list_of_inputs))

def _check_prime_sample_(n):
    if n &lt; 2:
        return False
    for i in range(2, n):
        if n % i == 0:
            return False
    return True


def find_integer_with_most_divisors(input_list):
    from operator import itemgetter
    lis = []
    dic = {}
    for elements in input_list:
        sub_lis = []
        for items in range(1, elements):
            if elements % items == 0 and _check_prime_sample_(items) == True:
                sub_lis.append(items)
        lis.append(len(sub_lis))
        dic[elements] = len(sub_lis)
    tup = [(k, v) for k, v in dic.items()]
    sup = max(tup, key=itemgetter(1, 0))
  
    print('{} {}'.format((sup)[0], (sup)[1]))


find_integer_with_most_divisors(list_of_inputs)
In this example, your code is used as the starting point. I moved the logic
around a bit -- notably, separating things into other functions -- and
suggested various other changes for you to consider.
# Except for special reasons, put all imports at the top.
import math
import sys

# Put almost all code inside functions.

def main(args):

    # When feasible, use variable names that sound like ordinary English (eg,
    # inputs) rather than awkward computer-science-like names (eg,
    # list_of_inputs). Similarly, if a variable holds one thing, use a singular
    # variable name (eg, num, book, or x). And if the variable holds a
    # collection of things, use plural (eg, nums, books, or xs).

    # Also, list/set/dict comprehensions can often make code easier to
    # understand, especially when they are fairly short.

    # For scripts like this, it's often useful to allow the possibility for
    # command-line arguments.

    if args:
        nums = [int(a) for a in args]
    else:
        # Provide users at least some minimal guidance.
        prompt = 'Integer: '
        nums = [int(input(prompt)) for _ in range(5)]

    # Computing the number with the most divisors is pure mathematical
    # algorithm: keep it that way. The function should do its work and return a
    # value. Do the printing elsewhere -- for example, in main().

    # By default, print() takes a list of values and prints them
    # separated by spaces. If that's all you need, there's
    # no reason to use a format string.

    num, n_divisors = find_integer_with_most_divisors(nums)
    print(num, n_divisors)

# If a function returns True/False, intuitive names often take the
# form of is_X, has_X, contains_X, and so forth.

def is_prime(n):
    if n &lt; 2:
        return False
    # You don't need to check beyond the square root of N.
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True

# Your version of this function used some good techniques, but it was more
# complex and harder to understand than necessary, mostly because the function
# was doing too many jobs at the same time: computing divisors for each number,
# finding the number with the most divisors, and reporting to the user. Keeping
# things separate often increases flexibly and code clarity.

# Let's start by moving the divisor computation to its own function. Again, we
# only need to check up to square root. There are faster ways to compute
# divisors, but this example prioritizes simplicity.

def divisors(n):
    divs = {1, n}
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            divs.add(i)
            divs.add(n // i)
    return sorted(divs)

# Now the program's primary function because very easy to write and understand.
# Also, we continue with the theme of selecting variable names that approximate
# ordinary English-language usage.

def find_integer_with_most_divisors(nums):
    counts = []
    for num in nums:
        divs = divisors(num)
        primes = [d for d in divs if is_prime(d)]
        # If you put the count first in the tuple, functions like
        # sort(), max(), min() will work exactly as desired.
        counts.append((len(primes), num))
    count, num = max(counts)
    return (num, count)

# Invoke main() with any command-line arguments, if the code was executed as a
# script. If the code is imported, main() won't be called. This device makes
# your script easier to test.

if __name__ == '__main__':
    main(sys.argv[1:])