have
tried unsuccessfully to modify some of these to suit my purpose. Also on the
web there are numerous sites where you can type in a word and it will give
you a list of all the words that could be made from it. How would I go about
this in python?
thanx,
kreglet
--
View this message in cont
, ('t', 1)]
countletters("bats")
[('a', 1), ('b', 1), ('s', 1), ('t', 1)]
bat is in batty. bats is not.
I have a list of words in wordlist.txt. I can write a loop the do the letter
counts for each word, but I can't figure out how
on't know why. Seems to me that any of the above should work.
mainword = countletters('batty')
cmpword = countletters('bat')
myfunc(cmpword, mainword)
Generates error:
Traceback (most recent call last):
File "/home/kreglet/bin/test.py", line 23, in
myfunc(
eft to guess.
When I am finished this project, I plan to post it somewhere so that others
can learn from it too.
Peace,
kreglet
Mac Ryan wrote:
>
>
> Of course doing things by yourself is more exciting and fun (and above
> all you have the pleasure to learn something new), but if
uot; is Not in: " + lc.mainword
Lol, it aint pretty, and it almost works. If you change the letters in
lc.cmpword you'll see what I mean.
There's got to be another way :)
cheers,
kreglet
Wayne-68 wrote:
>
>
>
> That's correct - your function countletters returns
on the same level as the else statement:
lc.mainword="batty"
lc.cmpword="bat"
[('a', 1), ('y', 1), ('b', 1), ('t', 2)]
[('a', 1), ('b', 1), ('t', 1)]
a 1 1
b 1 1
t 1 2
bat IS Not in: batty
Neithe
opt hnopty
o h No Match:
o n No Match:
o o Match:
p p Match:
t t Match:
Traceback (most recent call last):
File "/home/kreglet/bin/knt.py", line 45, in
if cmpword[letter]
>
> Another way to do this:
> - sort the letters in the target word; for example 'python' be
lot to learn. I really
appreciate the time you took to help and teach me.
Thanx,
kreglet
--
View this message in context:
http://www.nabble.com/Algorithm-tp25107922p25145813.html
Sent from the Python - tutor mailing list archive at Nabble.com
This is my first Python project. I am doing this to help me learn the
language. I was wondering if someone could give
me some advice as I have a lot of questions.
1. I would like to have someone look over the code and tell me how
to improve it. I am sure that a lot of it can be done better t
I keep getting the following error and don't uderstand why:
Traceback (most recent call last):
File "/home/kreglet/bin/test.py", line 15, in btnStatclick
btnStat.set_label("Pressed")
NameError: global name 'btnStat' is not defined
#!/usr/bin/env p
I am having a problem with GtkDialogs.
Ref: http://faq.pygtk.org/index.py?req=show&file=faq10.011.htp
http://faq.pygtk.org/index.py?req=show&file=faq10.011.htp
I want to add a treeview to the dialog.
The first time btnDialog is pressed the dialog shows with the treeview in
it.
If I press b
11 matches
Mail list logo