Practice makes perfect: is_prime
The error message it displays is " Your code threw a "int() argument must be a string or a number, not 'list'" error."
This lesson has been particularly confusing for me and I just can't figure out how to go about solving this problem. I know that for the current code I have it won't work due to the fact that n is still a list. However I have tried to convert it into an integer with no success, which leads me to believe that there is some other solution. I have been working on this one problem for some time now and would like some insight. I don't want the answer I just want to understand how my current logic is flawed and how (if it is possible/helpful) to change a list into an integer or why that (changing the range to an integer) is not a way to solve this problem.
def is_prime(x): if x >= 2: n = (range(2, x - 1) if x % n == 0: return False else: return True else: return True