Deleted


#1




I'm stuck on this exercise because of a seemingly unnecessary error. The program works in the way that it is supposed to, with each character of "spam!" lbeing printed seperately, but every time, I get this error:

Traceback (most recent call last):
File "python", line 10, in
TypeError: string indices must be integers, not tuple

Here is my code:

thing = "spam!"

for c in thing:
    print c

word = "eggs!"

# Your code here!
for character in word:
    print word[0,5]


Is there something I'm missing? Help would be much appreciated.


#2

look at this loop:

for c in thing:
    print c

it will print every character of the string stored in the thing variable, make a similar loop to print every character of the string stored in word


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.