Nov-06-2022, 02:09 AM
This is still wrong.
Research the for loop. It has a feature that would be useful for this program.
for x in range(2, user_input - 1): # I don't like the range, but not an error if user_input % x == 0: # This is correct print('number is not prime') else: # This is wrong print("number is prime")user_input % x != 0 is not enough to know that the number is prime. You have to test every factor before you can say the number is prime.
Research the for loop. It has a feature that would be useful for this program.