12. For your A -Oops, try again. Did you replace all of the "A"s and "a"s with "X"s? It looks like you printed "XX" instead of "X b i r d i n t h e h X n d . . ."


#1



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

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


`python

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

Add your for loop

for char in phrase:
if char is "A" or char is "a":
print "X"
else:
print char,


#2

You forget the , after the "X"
my code :

for char in phrase:
    if char == 'A' or char == 'a':
        print 'X',
    else:
        print char,

#3

thanks, but it did not helped me when i added ","
so..

if char is 'A' or char is 'a' is the difference beetwen this line and " if char == 'A' or char == 'a':"?


#4

doesn't matter is or ==
put all your code here with the Preformatted text in the editor of the forum (cmd + shift + C)


#5

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

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

#6

this code also does not work....;/


#7

You have to care about the indentation of you else:


#8

so where it should be?
i tried with different options but it does not work


#9

i know i did not have print at the end;)


#10

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