On Sunday, August 5, 2012 7:46:54 PM UTC-4, PeterSo wrote: > I am just starting to learn Python, and I like to use the editor > > instead of the interactive shell. So I wrote the following little > > program in IDLE > > > > # calculating the mean > > > > data1=[49, 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11] > > > > def mean(data): > > return sum(data)/len(data) > > > > mean(data1) > > > > > > There is no syntax highlighting and when I ran it F5, I got the > > following in the shell window. > > > > > > >>> ================================ RESTART > > ================================ > > >>> > > >>> > > > > > > Any ideas? > > If I added print mean(data1), it gave me a invalid syntax > > > > # calculating the mean > > > > data1=[49, 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11] > > data2=[1,2,3,4,5] > > > > def mean(data): > > return sum(data)/len(data) > > > > mean(data1) > > print mean(data1)
did you call you file xxx.py IDLE looks for the .py extension to identify the program as python code. -- http://mail.python.org/mailman/listinfo/python-list