I am trying to teach myself python by writing a simple program to test if a number is prime or not. It seems to me like the code should work but when I run it I am not getting asked to input a number even though I am using raw_input() like it says to do here, Python: user input and commandline arguments. What should I do to fix this?
class PrimeTester: def primeTest(number): if number == 2: print("prime") if number % 2 == 0: print("not prime") highesttestnum = number ** 0.5 + 1 count = 3 while count <= highesttestnum: if number % count == 0: print("not prime") count += 2 print("prime") def __init__(self): x = int(raw_input('Input a number to test if prime:')) print("The number " + x + " " + primeTest(x))
PrimeTester?