12/19 For your A


#1


Can someone pls hlp me with this code?


    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


Codecademy says, "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 . . .".    # <= I replaced all the 'a's and 'A's with 'X'. This doesn't make sense. 

Console prints:
    X
      b i r d   i n   t h e   h X n d . . .
    None

I thought the code was OK.


C is not Defined
#2


Tried this code too, but didn't work:


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

    # Add your for loop

    for c in phrase:
        if c == 'A' or c == 'a':
            print 'X'
        else:
            print c,
 
    #Don't delete this print statement!
    print


#3

you need , after print 'X'


#4


Thks a lot.

#5

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


#6

phrase="A bird in the hand..."
for char in phrase:
if char=="A"or char=="a":
print"X",
else:
print char,
print

"this is the answer"