12. for your a


#1



Replace this line with your code. 


phrase = "A bird in the hand..."
# Add your for loop

for char in phrase:
    if char.lower()=="a":
        print 'X',
    else:
        print char


#2

Hi, @scientist1995 ,

Sometimes a detail, such as a missing comma, is enough to make the output different from what is specified in the instructions. Your output includes this line ...

X n

Check the the details of your code.

Make sure that you do not remove the final print statement that was given in the default code.


#3

please help

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

Add your for loop

for char in phrase:
if char == 'a' :
print 'x'
elif char == 'A' :
print 'x'
else:
print char,


#4

@scientist1995 ,

Your code is not formatted, so we cannot see its indentation.

You are missing the comma at the end of both occurrences of this statement, so the output position moves to the next line, which it should not do for this exercise ...

print 'x'

Also note that the instructions ask you to print uppercase 'X', and you have lowercase.

What happened to this statement, which you were asked not to delete?

print

#5

thanks a lot sir it solved my problems :P:


#6

correct code

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

Add your for loop

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


#7

your final code does not work for me?!?


#8

@rachel_sugden,

That's because it wasn't indented correctly, and it didn't include the first line. Try this:

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

Alternatively, you can use this code, which works the same way but replaces the elif statement with an 'or' in the first if statement:

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

#9

your must be add an , after the print statement that is print char,


#10