[Tutor] List issues

Albert-Jan Roskam fomcl at yahoo.com
Thu Apr 17 14:07:28 CEST 2014


 

----- Original Message -----
> From: Dave Angel <davea at davea.name>
> To: tutor at python.org
> Cc: 
> Sent: Thursday, April 17, 2014 12:03 PM
> Subject: Re: [Tutor] List issues
> 
>& quot;Wheeler, Gabriel" <wheelerg at seattleu.edu> Wrote in message:
>> 
> 
> (not much I could read there. This is a text mailing list, so
> please tell your mail program to send in text mode, not html.
> Only parts of your code were visible here, and your question not
> at all. Fortunately, Peter quoted all or most of your message. 
> His comments are all good.  Mine are in addition,  not instead.
> 
> 
> Your code:
> 
> list = [1,2,2,2,3,4]
> 
> def duplicate(list):
>    for i in range(len[list]):
>        if list.count(i) > 1:
>            return True
> 
> print duplicate(list)
> 
> ............
> 
> Peter's hints should fix your main bugs. Then:
> 
> When an if-test doesn't seem to be doing what you expect,  add a
> print statement right before it of the exact expression it's
> testing.  

and/or use the pdb debugger (still on my own todo list, but I know it is useful!): http://pymotw.com/2/pdb/


More information about the Tutor mailing list