For your A


#1



Hi All,

I'm stuck and not able to understand what's gone wrong, please advise,


https://www.codecademy.com/en/courses/python-beginner-en-cxMGf/1/4?curriculum_id=4f89dab3d788890003000096#

below is the error message

Oops, try again.
Did you replace all of the "A"s and "a"s with "X"s? It looks like

you printed "X X ." instead of "X b i r d i n t h e h X n d . .
.".


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

# Add your for loop
for char in phrase:
    if char == "A" or char == "a":
        print "X",
        
else:
    print char,



#Don't delete this print statement!
print


#2

hi I've just got it myself, I used the else outside the if.


#3

Take your indentation of else one tab inward. See below

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

# Add your for loop
for char in phrase:
    if char == "A" or char == "a":
        print "X",
    else:
        print char,

#Don't delete this print statement!
print

#4

yeah I just figured that out :smile: thanks


#5

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