A prime number checker (Multi numbers).py so obviously this SIMPLE code checks if the number is prime or not. I need to make it more advanced, easier to use, fewer lines or any improvement.
while True:
    lista = []
    try:
        num = int(input(&quot;Enter the amount of numbers: &quot;))
        for i in range(0, num):
            value = int(input(&quot;Enter the numbers one by one: &quot;))
            lista.append(value)
    except:
        print(''';-;
    Bruh, make sure you are entering numbers.''')
    for i in lista:
        if i &lt;= 1:
            print(&quot;Duh,&quot;, i, &quot;is not a primal number.&quot;)
            continue
        for j in range(2, i):
            if i % j == 0:
                print(&quot;Duh,&quot;, i, &quot;is not a primal number.&quot;)
                break
        else:
            print(&quot;SMH,&quot;, i, &quot;is a primal number obviously.&quot;)
First improvement I see is mathematical: to check if a number n is prime, it's sufficient to verify that it's not divisible by any integer between 2 and math.ceil(math.sqrt(n)) (don't forget to import math at the top of your file). That's going to make your program more efficient.
Another improvement would be to split the code that deals with getting the list of numbers lista from the user, and the code that finds if a single number is prime or not, into two separate functions that you call from the main while True loop. This will aid readability and code reuse.
A third improvement is to rename the variable lista to a more expressive name like numbers or candidates or something else.