For your A: What is my wrong?


#1

phrase = "A bird in the hand..."

for i in phrase:
if i == " ":
continue
if i == "A" or i == "a":
print "X" + " "
else:
print i + " "

print


#2

you need to use , to print everything at the same line, see the instructions


#3

I corrected the code to this one:

phrase = "A bird in the hand..."

for char in phrase:
    if char == " ":
        continue
    if char == "A" or char == "a":
        print "X" + " ",
    else:
        print char + " ",





#Don't delete this print statement!
print

But I got an error:
Oops, try again. Did you replace all of the "A"s and "a"s with "X"s? It looks like you printed "X b i r d i n t h e h X n d . . ." instead of "X b i r d i n t h e h X n d . . .".


#4

please do what the instructions tell, i don't see any mention of if char == " ": continue or printing spaces when printing X or char


#5

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