[Tutor] Conway's game of life

2019-02-21 Thread Phil
oard[x][y] = board[x][y] board = next_board display() -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Converting a string to a byte array

2017-09-25 Thread Phil
exited, so your bytes may be lurking in the buffer, unsent. Thank you Cameron, that sounds like a logical explanation. I'll try it. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.

Re: [Tutor] Converting a string to a byte array

2017-09-24 Thread Phil
o bytes, Thank you for the code and the explanation, it's greatly appreciated. It's all a bit of an anticlimax really. Now that it works I don't know what to do with it. Like so many of my projects. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To u

[Tutor] Converting a string to a byte array

2017-09-24 Thread Phil
; mybytes = bytes(mytext) byte = byte + '\n' ser.write(mybytes) I don't understand why this works from the pyqt IDE but not when run from the console. I suppose the IDE is adding the correct encoding. I suspect utf8 is involved somewhere. -- Regards, Phil __

Re: [Tutor] Tkinter + frame + grid question

2017-05-15 Thread Phil
is now clearer to me now, plus I now see why I should include the use of columnconfigure and sticky. I knew about tix but hadn't investigated it until now. I'll have to play with it. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsub

[Tutor] Tkinter + frame + grid question

2017-05-15 Thread Phil
, column = 1) #Entry2 = Entry #Entry2(frame).grid(row = 20, column = 1) root = Tk() app = App(root) root.mainloop() -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https

Re: [Tutor] Another set question

2017-05-01 Thread Phil
round with different types, they're all sets. I now have a working solution. Many of the methods have very similar code to each other and I'm currently working on making the code simpler and less confusing. After that I'll give programming a rest for awhile. -- Regards, Phil __

Re: [Tutor] Another set question

2017-04-29 Thread Phil
solution in Python in a little over a week. The strings are the given numbers while the sets are the likely candidates. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Another set question

2017-04-29 Thread Phil
On Fri, 28 Apr 2017 19:42:36 -0700 "Martin A. Brown" <mar...@linux-ip.net> wrote: > > Hello and greetings Phil, > > >> I'm trying to implement a conditional branch based on a variable > >> type. > > > >This is often (not always) a mistake

[Tutor] Another set question

2017-04-28 Thread Phil
n the sets and want to ignore the character lists. I have come up with a method that will probably work but it's become quite messy with multiple compare statements. Something simple and less prone to cause headaches would be better. -- Regards, Phil ___

Re: [Tutor] Sets question

2017-04-27 Thread Phil
the throwaway single-entry set. Thank you Peter. I have been using the remove() method which, by the look of it, may do the same thing as discard(). I'll have a play and see. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] Sets question

2017-04-26 Thread Phil
On Thu, 27 Apr 2017 01:58:39 + eryk sun <eryk...@gmail.com> wrote: > That exception indicates you probably used set(int(num)) instead of > either {int(num)} or set([int(num)]). Thank you Eryl, you are correct. Problem solved. -- R

Re: [Tutor] Sets question

2017-04-26 Thread Phil
On Wed, 26 Apr 2017 18:56:40 -0600 Mats Wichmann <m...@wichmann.us> wrote: > On 04/26/2017 06:33 PM, Phil wrote: > > Another question I'm afraid. > > > > If I want to remove 1 from a set then this is the answer: > > > > set([1,2,3]) - set([1]) > >

[Tutor] Sets question

2017-04-26 Thread Phil
this time the one set is represented as {'1'} and, of course {'1'} is not in the set {1,2,3}. Ideally, I would like {'1'} to become {1}. Try as I may, I have not discovered how to remove the '' marks. How do I achieve that? -- Regards, Phil ___ Tutor

Re: [Tutor] Tkinter layout question

2017-04-26 Thread Phil
look next eek when I get back. Thanks Alan, maybe the reason that I'm in the moderation queue is because I'm on the bounces list. I'm on six different bounces lists but I'm still receiving e-mail so I suppose there isn't a real problem. -- Regards, Phil __

Re: [Tutor] Tkinter layout question

2017-04-24 Thread Phil
On Mon, 24 Apr 2017 20:02:32 +0100 Alan Gauld via Tutor <tutor@python.org> wrote: > On 24/04/17 01:50, Phil wrote: > > On Mon, 24 Apr 2017 09:24:55 +1000 > > Phil <phil_...@bigpond.com> wrote: > > > >> On Sun, 23 Apr 2017 09:39:54 +0200 > >

Re: [Tutor] Tkinter layout question

2017-04-24 Thread Phil
t root.mainloop() isn't necessary in that the > > result is the same with or without. Perhaps it serves some other > > purpose? > > Try running it from the command line, not in idle. In every tkinter > program there must be a main loop to respond to events. Thank you again P

Re: [Tutor] Tkinter layout question

2017-04-23 Thread Phil
On Mon, 24 Apr 2017 09:24:55 +1000 Phil <phil_...@bigpond.com> wrote: > On Sun, 23 Apr 2017 09:39:54 +0200 > Sibylle Koczian <nulla.epist...@web.de> wrote: > > > Am 20.04.2017 um 14:43 schrieb Alan Gauld via Tutor: > > > Its not too bad you can map the large

Re: [Tutor] Tkinter layout question

2017-04-23 Thread Phil
ment becomes > > divmod(7) -> 2,1 > > > > Should be divmod(7, 3), shouldn't it? Thanks Sibylle, I eventually stumbled upon the answer using my usual trial-and-error method. The 3, as in the number of cells, was the key. -- Regards, Phil

Re: [Tutor] Tkinter layout question

2017-04-23 Thread Phil
sure why. if root = tk.Tk() then why isn't table_class.DisplayTable(root, the same as table_class.DisplayTable(tk.Tk(),. Obviously it isn't but I don't know why. Also I found that root.mainloop() isn't necessary in that the result is the same with or without. Perhaps it serves some other purpo

Re: [Tutor] Tkinter layout question

2017-04-22 Thread Phil
gridcolor='red', hdcolor='black') second_tab.pack(side = tk.LEFT) tab.pack() I've tried different pack options including packing onto the parent frame. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] Tkinter layout question

2017-04-22 Thread Phil
tice" is to avoid star imports which bind every name from > table_class that does not start with "_", including 'tk' to the same > name in the importing module. > Thank you Petter for explaining these points, most helpful. -- Regards, Phil ___

Re: [Tutor] Tkinter layout question

2017-04-21 Thread Phil
reference to tkinter. Have I used you table class correctly? It works, of course, but it doesn't look correct. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter layout question

2017-04-20 Thread Phil
you for your detailed answer, more food for though. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter layout question - solved

2017-04-20 Thread Phil
On Wed, 19 Apr 2017 22:21:28 -0500 Just to save people answering this question unnecessarily I have solved the immediate problem. I can now enter a digit at the mouse coordinates. Some refinement is still necessary. -- Regards, Phil ___ Tutor

Re: [Tutor] Tkinter layout question

2017-04-20 Thread Phil
examples is so small that I need a magnifying glass to read them. Anyway, maybe I can justify one book, I'll give it some thought. The massive tome by Lutz comes to mind. I'll give your keyboard entry suggestion some more thought. -- Regards, Phil __

[Tutor] Tkinter layout question

2017-04-19 Thread Phil
, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter and canvas question

2017-04-18 Thread Phil
error being elsewhere and didn't think about the_canvas being just another attribute of the class. It seem obvious now that I've been shown. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Tkinter and canvas question

2017-04-17 Thread Phil
ve_button) def solve(self): print("solve called") self.the_canvas.create_text(20,20,text="5") def main(): root = Tk() app = Sudoku(root) app.mainloop() if __name__ == '__main__': main() -- Regards, Phil _

Re: [Tutor] Tkinter entry box text changed event

2017-04-10 Thread Phil
ly have self as a single parameter and wondered if "event" was the other parameter. I hadn't though of printing the event. Take no notice of this message's posting time, I started my Raspberry Pi before the modem had established an Internet connection. It's pre sunrise here. -- Regards,

Re: [Tutor] Tkinter entry box text changed event

2017-04-10 Thread Phil
"self", this is the result: Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.4/tkinter/__init__.py", line 1536, in __call__ return self.func(*args) TypeError: my_method() takes 1 positional argument bu

[Tutor] Tkinter entry box text changed event

2017-04-09 Thread Phil
tion) def my_function(event): print("function called") The function is not called and I know that the binding of the function to the entry boxes is not the correct method. What am I missing? -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Tkinter class question

2017-04-08 Thread Phil
master, > text="Check", > command=self.check_2_2 # note there's no () -- the bound > method # is not invoked > ) > ... > My working method uses the () but I will remove them and see what difference it makes. -- Regards, Phil __

Re: [Tutor] Tkinter class question - solved

2017-04-08 Thread Phil
On Sat, 8 Apr 2017 02:00:38 +1000 This is one of those times where I wish I could delete a sent message. After a bit more thought I now realise that I just need to use self to reference e[][] in my check function. -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Tkinter class question - refinement

2017-04-07 Thread Phil
On Sat, 8 Apr 2017 02:00:38 +1000 Phil <phil_...@bigpond.com> wrote: If I define "e" lists before the class then everything works as I had expected, however, I don't that's technically correct. Or is it? -- Regards, Phil ___ Tutor ma

[Tutor] Tkinter class question

2017-04-07 Thread Phil
w=7, column=7) def check(self, array): print("checked") array[2][2].insert(0, "4") root = Tk() my_gui = TestGUI(root) root.mainloop() -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter grid question

2017-04-07 Thread Phil
]] > Thank you Peter, that makes sense. What I'm trying to do is convert a sudoku solver that I wrote using C++ and the QT library in 2005. As well as coming to grips with Tkinter I'm having trouble following my C++ code. -- Regards, Phil ___ T

Re: [Tutor] Tkinter grid question

2017-04-07 Thread Phil
nt() and Duckduckgo do get a good workout. In this case I become confused because had expected [][] to be the same as a C two dimensional array. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options

[Tutor] Tkinter grid question

2017-04-07 Thread Phil
t turned up anything. Where had I failed? -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] UDP client

2017-02-27 Thread Phil
On 26/02/17 19:41, Peter Otten wrote: Try buf.decode("utf-8") Thank you once again Peter. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] UDP client

2017-02-26 Thread Phil
On 26/02/17 18:42, Alan Gauld via Tutor wrote: On 26/02/17 06:44, Phil wrote: s.connect((host, 1210)) data = "GET_LIST" This is a string, you need to use bytes. data = bytes("GET_LIST",'utf8') Thank you Peter and Alan for your response. Converting "data" t

[Tutor] UDP client

2017-02-25 Thread Phil
buf): break #print "Received: %s" % buf According to the Python3 wiki sendto() should work under Python3 but I get this error: Traceback (most recent call last): File "/home/phil/Python/predict_client1.py", line 12, in s.sendall(data) TypeError: a bytes-

Re: [Tutor] Basic telnet question

2016-09-24 Thread Phil
On 25/09/16 01:01, David Rock wrote: On Sep 24, 2016, at 04:21, Phil <phil_...@bigpond.com> wrote: The problem is that the client is not responding, certainly not as expected. There aren't any Python errors either, however, the console is blocked until the client is disabled

Re: [Tutor] Basic telnet question

2016-09-24 Thread Phil
the telnetlib module seemed to be a more logical choice. Is there some advantage to using the socket module? -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo

[Tutor] Basic telnet question

2016-09-24 Thread Phil
blem. By the way, I'm using Python 3.5 under Linux. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Python 3 - bugs or installation problem

2015-03-04 Thread Phil
I hope this is not another embarrassingly obvious answer to a simple question. Python 3, under Kubuntu. xrange() fails whereas range() is accepted. Could this be an installation problem? phil@Asus:~/Python$ python3 Python 3.4.2 (default, Oct 8 2014, 13:18:07) [GCC 4.9.1] on linux Type help

Re: [Tutor] List of ints

2015-03-03 Thread Phil
with the aim of porting a programme that I'd written in C++ 15 years ago to Python. Cutting and pasting and even moving around the IDE turned out to be a truly frustrating exercise. I wonder if it was just my clumsiness or if others have had the same experience? -- Regards, Phil

[Tutor] List of ints

2015-03-02 Thread Phil
; TypeError: 'int' object is not iterable The array module looks like the answer because it seems to function in the same way as an array under C. However, it seems to me that I should be able to do the same thing with a list. Is there a way to add a value to a list of ints? -- Regards, Phil

[Tutor] webservice question

2015-01-29 Thread Phil H
, how do I pass the variable key's value and return the variable tag's value. Thanks in advance for any help, I've tried a bunch of stuff and its just not working. Phil ___ Tutor

[Tutor] Allocation of serial ports

2013-11-29 Thread Phil
ports. The problem is the random allocation of the ports. Port A, for example, could be either ttyUSB0 or ttyUSB1. So, how can I ensure that port A is always ttyUSB0 or how can I adapt my programme so that the address of the port is known to the programme? -- Regards, Phil

Re: [Tutor] Allocation of serial ports

2013-11-29 Thread Phil
On 11/29/2013 06:17 PM, Dominik George wrote: Hi, So, how can I ensure that port A is always ttyUSB0 http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/ Thank you Dominik, the link answers my question exactly. -- Regards, Phil

Re: [Tutor] Retrieving data from a web site

2013-05-20 Thread Phil
of how json works. I discovered my error just before receiving your reply. I'm a little embarrassed to admit that despite giving you the correct url I had attempted to get the results from another tatts page. Thank you again, your help is greatly appreciated. -- Regards, Phil

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another library that I can use to download data from a web page? -- Regards, Phil

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
On 19/05/13 18:05, Peter Otten wrote: Phil wrote: My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another library that I can use to download

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
dependency problem. I haven't checked to see if it's built into Python yet, it's getting a bit late here. A job for tomorrow. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
the dependency error. However, I do have an error and I'm not completely certain that I understand how the code provided by Peter works. The following is the error message: Traceback (most recent call last): File /home/phil/Python/lotto.py, line 10, in module data = json.loads(s) File

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 16:33, Alan Gauld wrote: On 18/05/13 00:57, Phil wrote: I'd like to download eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
, whatever2.jpg, ...? Then you could infer the value from the name. If not, is a digit always represented by the same image? Then you could map the image urls to the digits. Good point Peter, I'll investigate. -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
, how I might do that but I have something to work with. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
Soup and see what I can come up with. Maybe unzipping the file could be the best solution, I'll experiment with that option as well. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

[Tutor] Retrieving data from a web site

2013-05-17 Thread Phil
I'd like to download eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? -- Regards, Phil ___ Tutor

[Tutor] Classes in multiple files

2013-04-03 Thread Phil
examples that deal with displaying dialogs, however, both classes are in the same file rather that being separated. No doubt, this is a trivial question but, as yet, I have not found an answer. -- Regards, Phil ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Classes in multiple files - code included

2013-04-03 Thread Phil
) function but I still end up with a not defined error. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Classes in multiple files - code included

2013-04-03 Thread Phil
On 04/04/13 11:58, Steven D'Aprano wrote: On 04/04/13 12:47, Phil wrote: And this is the error message; global name 'Ui_satListDialog' is not defined On its own, that is almost useless. Python gives you more debugging information than that: it gives you a complete traceback, which includes

Re: [Tutor] pyqt4 set horizontal header item - solved

2013-04-01 Thread Phil
On 01/04/13 19:47, eryksun wrote: On Sun, Mar 31, 2013 at 8:13 PM, Phil phil_...@bigpond.com wrote: I have the answer (provided by a member of another list) and I was correct, it was something basic. from PyQt4 import QtGui QtGui.QTable etc Sorry, I assumed you were familiar

[Tutor] pyqt4 set horizontal header item

2013-03-31 Thread Phil
? -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] pyqt4 set horizontal header item - extra info

2013-03-31 Thread Phil
On 31/03/13 14:29, Phil wrote: Thank you for reading this. I want to set a table widget header based on its cell contents. The following sets all of the headers; self.tableWidget.setHorizontalHeaderLabels([One, Two, Etc]) However, self.setHorizontalHeaderItem ( 1, [test

Re: [Tutor] pyqt4 set horizontal header item - extra info

2013-03-31 Thread Phil
name 'QTableWidgetItem' is not defined You are correct, I can easily set all of the labels at once but only one label needs to be modified according to it's cell contents. I'm sure I'm missing something very basic. -- Regards, Phil ___ Tutor maillist

Re: [Tutor] pyqt4 set horizontal header item - solved

2013-03-31 Thread Phil
basic. from PyQt4 import QtGui QtGui.QTable etc As I previously said, I had done this under C++ many years ago. The Python method is far simpler, especially once you know how. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe

[Tutor] Udp socket questio

2013-03-26 Thread Phil
, in module import socket #for sockets File /home/phil/Python/socket.py, line 7, in module s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) AttributeError: 'module' object has no attribute 'AF_INET' -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Beep sound

2013-03-24 Thread Phil
On 24/03/13 12:18, Steven D'Aprano wrote: On 24/03/13 10:31, Phil wrote: Actually, I didn't think there was any need to make any guesses since echo -e is exclusively a Linux command. Nonsense. Not only does echo exist as a command on any Unix, including Apple Mac OS, FreeBSD, OpenBSD

Re: [Tutor] Beep sound

2013-03-24 Thread Phil
what's available to play with these days. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Beep sound

2013-03-24 Thread Phil
On 25/03/13 04:30, xDog Walker wrote: cut Maybe something here: http://code.activestate.com/search/recipes/#q=beep Thanks xDog, yet another sound library (pyaudio) to play with. -- Regards, Phil ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Beep sound

2013-03-24 Thread Phil
a brief look through the black list files a couple of days ago and didn't find any mention of pcspkr. I've decided to drop this and simply use a sound module because they provide greater scope for experimentation. -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Beep sound

2013-03-23 Thread Phil
On 24/03/13 03:42, Bod Soutar wrote: On Mar 23, 2013 2:24 AM, Steven Dapos;Aprano st...@pearwood.info mailto:st...@pearwood.info wrote: On 23/03/13 12:48, Phil wrote: Just out of curiosity how can a beep sound be generated? My interest in this came about because echo -e

[Tutor] Beep sound

2013-03-22 Thread Phil
icon to be displayed so it seems that the lack of a beep is due to a system setting. A Google search has shown several methods to play .wav files, some easier than others. Perhaps Pulse Audio has made '\a' redundant? -- Regards, Phil ___ Tutor maillist

Re: [Tutor] Dictionary get method

2013-03-20 Thread Phil
On 20/03/13 14:54, Amit Saha wrote: Hello Phil, On Wed, Mar 20, 2013 at 12:54 PM, Phil phil_...@bigpond.com wrote: Thank you for reading this. I'm working my way through a series of exercises where the author only provides a few solutions. The reader is asked to modify the histogram example

Re: [Tutor] Dictionary get method

2013-03-20 Thread Phil
not sure it's a simplification at my present level. -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Dictionary get method

2013-03-19 Thread Phil
histogram2(s): d = dict() for c in s: d[c]= d.get(c, 0) return d h = histogram(brontosaurs) print h print print histogram2 h = histogram2(brontosaurs) print h -- Regards, Phil ___ Tutor maillist - Tutor@python.org To unsubscribe

[Tutor] Print to file

2013-03-11 Thread Phil
The usage of print to file is much like the Arduino print to serial device and it's got me curious to know what the correct syntax is. Neither of the following is correct, but the second one seems closer to the mark. print(test, file=/home/phil/Python/words) Traceback (most recent call last