The range function creates an array of numbers between its parameters.
For example:
>>> range(1, 4)
=> [1, 2, 3]
In your code you’re saying a%b
which is finding the remainder between a number the user inputted and a range object. Think of the range object as a python list. So what you’re doing is 5 % [1, 2, 3] that doesn’t make sense. Check this separate thread to find out how to implement a prime number checker in python. Python Prime number checker
solved code that check if number is prime number [duplicate]