In the line if x in p: You are trying to check whether x in p , and p is not a sequence, but a prime number. For verification, you must use the comparison:
#!/usr/bin/env python3 a = int(input("Введите значение a: ")) b = int(input("Введите значение b: ")) x = int(input("Введите значение x: ")) for p in range(a, b): if x == p: print(x/a+b) else: try: x/a+b except: print("Error") finally: print()
I also recommend inserting a space after the colons, when data is being entered, this is common practice. You also apparently forgot to cast the int parameter value x .
==- Grundy