On 28/12/15 17:32, Joel Goldstick wrote:
> I believe the code following should not be indented as that makes it part
> of your function
>
>
>> numlist1 = [1,2,3,4,5]
>> numlist2 = [10,20,30,40,50]
>> largest = get_algorithm_result(numlist1)
>> print largest
Ah, that makes se
On 28/12/15 12:34, cicy felix wrote:
> Create a function get_algorithm_result to implement the algorithm below
> Get a list of numbers L1, L2, L3LN as argument
> Assume L1 is the largest, Largest = L1
> Take next number Li from the list and do the following
> If Largest is less than Li
>
On Mon, Dec 28, 2015 at 7:34 AM, cicy felix wrote:
> Hello there!
> Thank you for the good work you are doing at helping newbies to python.
> Please I'd like clarification with the exercise below:
>
> Create a function get_algorithm_result to implement the algorithm below
> Get a list of number
: [Tutor] Algorithm for sequence matching
To: "Walter Prins"
Cc: tutor@python.org
Date: Sunday, July 3, 2011, 5:48 PM
I know a way to do thatset1 = set(list1)set2 = set(list2)combined = set1&set2
On Sat, Jul 2, 2011 at 5:16 PM, Walter Prins wrote:
Hi Ankur,
On 2 July 2011 21:30,
I know a way to do that
set1 = set(list1)
set2 = set(list2)
combined = set1&set2
On Sat, Jul 2, 2011 at 5:16 PM, Walter Prins wrote:
> Hi Ankur,
>
> On 2 July 2011 21:30, ANKUR AGGARWAL wrote:
>
>> Hey
>> I am looking for an algo for the largest sequence search in the two list.
>>
>> Example :
ANKUR AGGARWAL wrote:
Hey
I am looking for an algo for the largest sequence search in the two list.
Example : list a accepts some say 'm' numbers. list b accept says 'n'
numbers. I want to look for the largest same sequence between the two list
and then display it. I tried out but failed to do s
Just to clarify further:
On 2 July 2011 23:46, Walter Prins wrote:
> On 2 July 2011 21:30, ANKUR AGGARWAL wrote:
>
>> Example : list a accepts some say 'm' numbers. list b accept says 'n'
>> numbers. I want to look for the largest same sequence between the two list
>> and then display it. I tri
Hi Ankur,
On 2 July 2011 21:30, ANKUR AGGARWAL wrote:
> Hey
> I am looking for an algo for the largest sequence search in the two list.
>
> Example : list a accepts some say 'm' numbers. list b accept says 'n'
> numbers. I want to look for the largest same sequence between the two list
> and the
ANKUR AGGARWAL wrote:
> Hey
> I am looking for an algo for the largest sequence search in the two list.
>
> Example : list a accepts some say 'm' numbers. list b accept says 'n'
> numbers. I want to look for the largest same sequence between the two list
> and then display it. I tried out but fai
Forwarding back to list.
-- Forwarded message --
From: ANKUR AGGARWAL
Date: 2 July 2011 22:23
Subject: Re: [Tutor] Algorithm for sequence matching
To: Walter Prins
ya sorry I forgot to include 11 . i want the answer to be [11,23,45,21]
On Sun, Jul 3, 2011 at 2:46 AM, Walter
Hi Ankur,
On 2 July 2011 21:30, ANKUR AGGARWAL wrote:
> Hey
> I am looking for an algo for the largest sequence search in the two list.
>
> Example : list a accepts some say 'm' numbers. list b accept says 'n'
> numbers. I want to look for the largest same sequence between the two list
> and the
On 7/2/2011 4:30 PM, ANKUR AGGARWAL wrote:
Hey
I am looking for an algo for the largest sequence search in the two list.
Example : list a accepts some say 'm' numbers. list b accept says 'n'
numbers. I want to look for the largest same sequence between the two
list and then display it. I tried
Matthew Matson wrote:
Hi Tutors,
I am looking for the proper approach regarding the analysis of a
dictionary of combinations I have.
What I need to do is read from a supplied text file that has a unique ID
and that unique ID's associated combination of elements. So let's say I
have the fol
I will see if I can code up a sample of
what I am trying to do.
Thanks again.
> Date: Thu, 11 Feb 2010 15:21:51 -0500
> Subject: Re: [Tutor] Algorithm for combination analysis suggestion.
> From: ken...@tds.net
> To: gtx...@hotmail.com
> CC: tutor@python.org
>
> On Thu,
On Thu, Feb 11, 2010 at 1:59 PM, Matthew Matson wrote:
>
> Hi Tutors,
>
> I am looking for the proper approach regarding the analysis of a dictionary
> of combinations I have.
>
> What I need to do is read from a supplied text file that has a unique ID and
> that unique ID's associated combination
Wayne, Kent, Alan, and Mac
Thank you for all the help and suggestions .
Wayne and Kent,
Both your solutions work great. The extra comments you gave on the code that
I tried will help reduce the line count and make the code more readable in
the rest of the project. Apparently, I still have a lo
On Tue, Aug 25, 2009 at 9:55 PM, Wayne wrote:
> I just did a quick test and this code seems to work correctly:
> def countletters(word):
> lettercount = {}
> for letter in word:
> lettercount[letter] = lettercount.get(letter, 0) + 1
> return lettercount
> def comparewords(cmpwor
On Tue, Aug 25, 2009 at 2:14 PM, kreglet wrote:
>
> Wayne,
> I appreciate your patience with me. I still can't get this to work:
>
>
> from operator import itemgetter
> class testwords:
> def __init__(self):
>self.lettercount={}
>
On Tue, Aug 25, 2009 at 5:03 PM, kreglet wrote:
>
> Hello Kent,
>
> Yes I would like to see your implementation. It seems to work but I get
> error at the end.
>
> concat=''.join
>
> mainword="python"
> cmpword="pot"
> # sort the letters in the target word; for example 'python' becomes
> 'hnopty'
Hello Kent,
Yes I would like to see your implementation. It seems to work but I get
error at the end.
concat=''.join
mainword="python"
cmpword="pot"
# sort the letters in the target word; for example 'python' becomes
'hnopty'
tmplst=[]
for letters in mainword:
tmplst.append(letters)
t
Wayne,
I appreciate your patience with me. I still can't get this to work:
from operator import itemgetter
class testwords:
def __init__(self):
self.lettercount={}
self.inword=False
self.main
On Mon, Aug 24, 2009 at 8:58 PM, kreglet wrote:
>
> Wayne,
>
> > def myfunc(cmpword, mainword):
> > for letter in cmpword:
> > if mainword.gets(letter):
> > if cmpword[letter] >mainword[letter]:
> > return False
> > else:
> > return False
>
> I tried your f
On Sun, Aug 23, 2009 at 6:06 PM, kreglet wrote:
>
> Hello,
>
> The problem that I am having is writing an algorithm for finding all the
> possible words from a given word. For example: python
>
> from "python" you can make the words pot, top, hop, not etc. There are few
> examples for making anagr
Wayne,
> def myfunc(cmpword, mainword):
> for letter in cmpword:
> if mainword.gets(letter):
> if cmpword[letter] >mainword[letter]:
> return False
> else:
> return False
I tried your function and couldn't get it to work. It threw an error in the
line "if
"kreglet" wrote
The reason I used print sorted is that using just print throws a syntax
error:
print (lettercount.iteritems(), key=itemgetter(1)) ---> error
print lettercount.iteritems(), key=itemgetter(1) ---> error
print sorted(lettercount.iteritems(), key=itemgetter(1)) ---> works
I don't
On Mon, Aug 24, 2009 at 10:48 AM, kreglet wrote:
>
> Wayne,
>
> The reason I used print sorted is that using just print throws a syntax
> error:
>
> print (lettercount.iteritems(), key=itemgetter(1)) ---> error
> print lettercount.iteritems(), key=itemgetter(1) ---> error
> print sorted(lettercou
Hello Mac,
Thanks for the tip.
I was aware of an and considered using it. I decided not to use it unless I
have no other choice. Although it does exactly what I am after:
a) I don't want to use any dependencies other than Python's built in
modules
b) You hit it right in the nose when you
Wayne,
The reason I used print sorted is that using just print throws a syntax
error:
print (lettercount.iteritems(), key=itemgetter(1)) ---> error
print lettercount.iteritems(), key=itemgetter(1) ---> error
print sorted(lettercount.iteritems(), key=itemgetter(1)) ---> works
I don't know why
On Sun, 2009-08-23 at 15:06 -0700, kreglet wrote:
> Hello,
>
> The problem that I am having is writing an algorithm for finding all the
> possible words from a given word. For example: python
>
> from "python" you can make the words pot, top, hop, not etc. There are few
> examples for making an
On Sun, Aug 23, 2009 at 10:01 PM, kreglet wrote:
>
> Alan,
>
> Thanks for the reply. This is not homework, it is a hobby. I am 44 years
> old. I was using Visual Basic, but recently decided to switch to Linux and
> have no intentions of going back to windows. Python seems like a good
> computer
Alan,
Thanks for the reply. This is not homework, it is a hobby. I am 44 years
old. I was using Visual Basic, but recently decided to switch to Linux and
have no intentions of going back to windows. Python seems like a good
computer language. I read somewhere the the best way to learn it was to
"kreglet" wrote
The problem that I am having is writing an algorithm for finding all the
possible words from a given word. For example: python
This sounds a lot like a homework.
We don't give direct help on homeworks but will try to point you
in the right direction. It helps if you tell/sho
32 matches
Mail list logo