> not defined. In other words, I have to write n = test() > myself in the IDLE window. Does it work outside IDLE? ie can you just douyble click the .py file? If not I suspect you are missing the if __name__ == "__main__": n = test() stanza to create a runnable script. In fact you can miss the if test out and just put a last line of test() But then you couldn't easily import the module elsewhere... Alan g.