[Tutor] Recursively flatten the list

2011-03-23 Thread Dharmit Shah
Hello, I am learning Python and yesterday I cam across a definition wherein I was supposed to flatten a list recursively. I am getting the solution properly but wanted to know if I can optimize the code further. #!/usr/bin/env python new_list=[] def flatten(num_list): """ >>> flatten([2

Re: [Tutor] Checksum program

2011-03-23 Thread Wayne Werner
On Wed, Mar 23, 2011 at 5:19 PM, Wayne Werner wrote: > > -- Forwarded message -- > From: Lezlie Kline > Date: Wed, Mar 23, 2011 at 9:30 AM > Subject: Re: [Tutor] Checksum program > To: Wayne Werner > > > Wayne, > > Thanks! That helped tremendously. Here's my problem with the acc

[Tutor] Fwd: Checksum program

2011-03-23 Thread Wayne Werner
Forwarding on to the list, as there are many other people who can also answer the questions. -- Forwarded message -- From: Lezlie Kline Date: Wed, Mar 23, 2011 at 9:30 AM Subject: Re: [Tutor] Checksum program To: Wayne Werner Wayne, Thanks! That helped tremendously. Here's m

Re: [Tutor] Checksum program

2011-03-23 Thread Lezlie Kline
Thanks for the links. Yes, I've worked with the tutorials. My work doesn't flow exactly along those lines, but they do help. I'll look up the the group you sent too. I appreciate all the extra effort you went to. Many thanks!!! :) On Wed, Mar 23, 2011 at 12:26 PM, taserian wrote: > On Wed,

Re: [Tutor] Checksum program

2011-03-23 Thread taserian
On Wed, Mar 23, 2011 at 11:11 AM, Lezlie Kline wrote: > I have a question for the list about the homework rule and the tutoring > list. If you have a question and you're not asking for your homework or > past homework to be done for you but you just have questions to be explained > isn't that wha

Re: [Tutor] Checksum program

2011-03-23 Thread Lezlie Kline
I have a question for the list about the homework rule and the tutoring list. If you have a question and you're not asking for your homework or past homework to be done for you but you just have questions to be explained isn't that what tutoring and learning is all about. For example, on my quest

Re: [Tutor] Checksum program

2011-03-23 Thread taserian
When replying to the Python Tutor list, please use "Reply All" instead of just "Reply". I meant to put this in my previous message, but it remained in "meant to" phase and never got implemented properly. 8-) I don't think it's been initialized properly, but that's where I don't understand about t

Re: [Tutor] Checksum program

2011-03-23 Thread michael scott
Hi Lezlie, Well first off, let me admit I have no idea what checksums are (I be a noobz) and I can not help you with that part of your program at all, but there are lots of people here who can. But since you are new to python, let me comment on some of the general things I noticed in your cod

Re: [Tutor] Checksum program

2011-03-23 Thread taserian
On Wed, Mar 23, 2011 at 9:55 AM, Lezlie Kline wrote: > Tony, > > For your question "What's the checksum for a completely empty message > (i.e., no characters at all)?" Do you mean the value or how do I write it? > I would think the value would be 0. > Correct. Now think of that as your starting po

Re: [Tutor] Checksum program

2011-03-23 Thread Tom Zych
Lezlie Kline wrote: > I'm trying to work out the bugs in a program for calculating the checksum > (modulo 256) of an input string. I'm testing it with my full name and I'm a > beginner with Python. Here's what I have so far. > > def main(): > print"This program creates a checksum for a mess

Re: [Tutor] Checksum program

2011-03-23 Thread taserian
On Wed, Mar 23, 2011 at 9:09 AM, Lezlie Kline wrote: > Hi, > > I'm trying to work out the bugs in a program for calculating the checksum > (modulo 256) of an input string. I'm testing it with my full name and I'm a > beginner with Python. Here's what I have so far. > > def main(): > print"Th

[Tutor] Checksum program

2011-03-23 Thread Lezlie Kline
Hi, I'm trying to work out the bugs in a program for calculating the checksum (modulo 256) of an input string. I'm testing it with my full name and I'm a beginner with Python. Here's what I have so far. def main(): print"This program creates a checksum for a message." name=raw_input("Pl

Re: [Tutor] getting the last file in a folder (reliably)

2011-03-23 Thread Steven D'Aprano
Peter Otten wrote: Steven D'Aprano wrote: files.sort() the_file_name = files[-1] You don't need to sort if you want only one file: the_file_name = max(files) Nice catch! -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or chan