On 03/03/15 17:46, Mark Lawrence wrote:

You are trying to increment the first element of count which is itself a
list containing one element.  You actually need:-

count[0][0] +=1


Thank you Lawrence, Alan, and Danny,

The solution is embarrassingly obvious. It's been a long time since I've attempted any programming and I'd even forgotten that I needed a nested loop to access the cells in a two-dimensional array, or list. In this case I didn't need a two-dimensional array anyway.

I'd been away from home for five weeks and during a quiet period I installed QPython on my tablet 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 maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to