Re: [Tutor] Homework problem

2011-07-20 Thread Ken Baclig
July 20, 2011 6:11 PM Subject: Re: [Tutor] Homework problem Ken Baclig wrote: > Hi, > > I'm trying to make a function that receives text (a string) as an argument > and returns the same text (as string), but with 1 added to each word that is > a number. What counts as a n

Re: [Tutor] Homework problem

2011-07-20 Thread Steven D'Aprano
Ken Baclig wrote: Hi, I'm trying to make a function that receives text (a string) as an argument and returns the same text (as string), but with 1 added to each word that is a number. What counts as a number? In the string: "Hello world 1234 ham spam" which of these do you expect to get b

Re: [Tutor] Homework problem

2011-07-20 Thread Alan Gauld
Ken Baclig wrote: Does this look right? Still a little confused Nope. Notice that Marc said NOT to operate on characters but to split() the string into a wordlist. Then test for each word in the wordlist to see if it isdigit(). Igf so then convert the word to an int() and add one. Then

Re: [Tutor] Homework problem

2011-07-20 Thread Ken Baclig
2011 3:45 PM Subject: Re: [Tutor] Homework problem On Wed, Jul 20, 2011 at 2:54 PM, Ken Baclig wrote: Hi, > > >I'm trying to make a function that receives text (a string) as an argument and >returns the same text (as string), but with 1 added to each word that is a >nu

Re: [Tutor] Homework problem

2011-07-20 Thread Marc Tompkins
On Wed, Jul 20, 2011 at 2:54 PM, Ken Baclig wrote: > Hi, > > I'm trying to make a function that receives text (a string) as an argument > and returns the same text (as string), but with 1 added to each word that is > a number. > > I need help getting started. > > So far, I have: > > def FindNumbe

[Tutor] Homework problem

2011-07-20 Thread Ken Baclig
Hi, I'm trying to make a function that receives text (a string) as an argument and returns the same text (as string), but with 1 added to each word that is a number. I need help getting started. So far, I have: def FindNumbers(a_string):     for index, char in enumerate(a_string):         if

[Tutor] Homework Problem Flaming (was: Help!)

2011-03-03 Thread Corey Richardson
On 03/03/2011 04:58 PM, James Reynolds wrote: > You are almost assuredly going to get flamed for not having a descriptive > title and for asking what is obviously homework questions > Maybe for not having a descriptive title, but there's nothing wrong with coming to the list with homework! The r

Re: [Tutor] Homework Problem

2010-05-29 Thread Alan Gauld
"Shawn Blazer" wrote This problem told me to use map and filter, so how would I use that to solve it? Because its homework we won't solve it for you, we will only answer questions or suggest approaches. From your earlier post it looks like you have all the tools: recursion, map and filte

Re: [Tutor] Homework Problem

2010-05-29 Thread spir ☣
On Fri, 28 May 2010 19:11:13 -0400 "Shawn Blazer" wrote: > > This problem told me to use map and filter, so how would I use that to > solve it? [some piece of interactive session] > Thanks! So, where's the problem? Denis vit esse estrany ☣ spir.wikidot.com

[Tutor] Homework Problem

2010-05-28 Thread Shawn Blazer
This problem told me to use map and filter, so how would I use that to solve it? remove ( 5 , 6 ) 6 remove ( 5 , 5 ) remove ( 1 , [1 , [1 , [2 , 13]] , 1 , [2] , 5] ) [[[2 , 13]] , [2] , 5] remove ( 2 , [1 , [1 , [2 , 13]] , 1 , [2] , 5] ) [1 , [1 , [13]] , 1 , [] , 5] Thanks! -- Usi