Max Niederhofer wrote:
Hello all,
first post, please be gentle. I'm having serious trouble finding an
alternative for the deprecated find module for dictionaries.
What find module for dictionaries?
The code (from Zed Shaw's Hard Way, exercise 40) goes something like
this. Hope indentation
Hello all,
first post, please be gentle. I'm having serious trouble finding an
alternative for the deprecated find module for dictionaries.
The code (from Zed Shaw's Hard Way, exercise 40) goes something like
this. Hope indentation survives.
cities = {'CA': 'San Francisco', 'MI': 'Detroit', 'FL'
I got stimulated to create a minimal tic-tac-toe program. No functions,
no classes.
board = [" "]*9
player = 'X'
prompt = "Player %s cell #, Q=quit, B=display board>"
while True:
cell = raw_input(prompt % player)
if cell in 'qQ': break
elif cell in 'bB':
print ('+---+' + '\n|%s%s%s|'*3
"Ben Ganzfried" wrote
if (cell % 3 == 0) and (self.__mycells[cell] ==
self.__mycells[cell +
1]) and (self.__mycells[cell + 1]== self.__mycells[cell + 2]):
TypeError: unsupported operand type(s) for %: 'instance' and 'int'
The error is in the first expression and the message tells you
wha
On 2/19/2011 3:49 PM, Ben Ganzfried wrote:
Hey,
I *think* that everything is working except my function gameWon. I
keep getting the following error: " line 67, in gameWon
if (cell % 3 == 0) and (self.__mycells[cell] ==
self.__mycells[cell + 1]) and (self.__mycells[cell + 1]==
self.__myc
Hey,
I *think* that everything is working except my function gameWon. I keep
getting the following error: " line 67, in gameWon
if (cell % 3 == 0) and (self.__mycells[cell] == self.__mycells[cell +
1]) and (self.__mycells[cell + 1]== self.__mycells[cell + 2]):
TypeError: unsupported operand
To start with, you don't need to do so much for loop.
You have already set the chosen word, word to correct.
Every randomly selected word becomes the value of correct so, you need to only
check for word in correct.
So, after initiating the random selector, you print the number of letters in
the
"jyatesster" wrote
Here is what I have so far. I think I am doing something wrong with
the for
loops as the program is not reading whether the letter is in the
constant
and giving the appropriate response.
Instead of having us guess it would be useful if you told us
(or better cut n paste)
On 02/19/2011 01:06 PM, jyatesster wrote:
> I am refreshing my memory of Python programming after taking a class this
> past fall. I am using the book, *Python Programming for the absolute
> beginner*. I am at chapter 4, challenge 4 which instructs me to create a
> program that picks a random word
I am refreshing my memory of Python programming after taking a class this
past fall. I am using the book, *Python Programming for the absolute
beginner*. I am at chapter 4, challenge 4 which instructs me to create a
program that picks a random word and the player has to guess the word. The
computer
10 matches
Mail list logo