Forwarding to tutor list, please use Reply All whjen replying to the group.
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
- Original Message
> full error printout. I tried debugging it and I still don't know why
> guessed[index] = (letter) gives me an
Yasin Yaqoobi wrote:
> # This is the line that gives me the error don't know why?
> guessed[index] = " " + (letter); ,TypeError: 'str' object does not
> support item assignment
I don't get this far because I run into
Traceback (most recent call last):
File "hangman.py", line 69, in
line =
"Yasin Yaqoobi" wrote
I'm confused. The error message you describe doesn't
appear to match any line in your code.
Please provide the full error printout not just a single line.
Meanwhile some comments...
global line
global index;
global is not doing anything here, it is only effective insi
global line
global index;
guessed = ["-"];
count = 0;
wrong = 0;
def guess(letter):
global guessed
if (letter in line):
index = line.index(letter);
print guessed;
# This is the line that gives me the error don't know why?
guessed[index] = " " + (letter); ,TypeError: 'st