I have to define a function called is_prime that takes a number x as input, then for each number n from 2 to x - 1, test if x is evenly divisible by n. If it is, return False. If none of them are, then return True.
The system I'm using (codecademy) has given my code the error message "Oops, try again. Does your is_prime function take exactly one argument (an integer)? Your code threw a "unsupported operand type(s) for %: 'int' and 'list'" error."
Please could someone to fix my code with an explanation of how my code is wrong?
def is_prime(x):n = range(2, x-1)if x % n == 0:return Falseelse:return True