Have you actually tried running this somewhere such as IDEONE? When I do, it gives a runtime error, and reports
Traceback (most recent call last):
File “./prog.py”, line 19, in
ValueError: invalid literal for int() with base 10: ‘10 20’
I think this line is the problem:
m, n = int(input()), int(input())
and needs to be replaced with something like:
m, n = [int(x) for x in input().split()]
The primesNumOp method is very odd. Why are numbers less than 7 treated differently from the others? What about composite numbers that are not divisible by 2, 3, 5 or 7?
For example, with the range 120 170, it gives
[121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169]
121, 143, and 169 are not prime. (Additionally, the numbers should be printed one per line, and you shouldn’t be printing those commas or brackets either.)
If you search this forum, you’ll find many questions about this problem, and ideas to resolve the issues you’re having.