12) Error that only prints X X



The code only prints X X and not the entire string with the a's replaced like it should

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

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

#Don't delete this print statement!


if you want to achieve what you are trying to achieve, i put else inside the for loop. At the same indent level as if


thank you very much, would you mind telling me what the difference is on how you indent the statement because on a previous assignment that was how i had to submit it


as you currently, else will only run if the for loop is false. If you put else at the same indent level, it will run each time the if statement is false.


while/for-else is quite different from if-else

the else to a loop runs if the loop was not broken (break) out of

@codeingkicks else needs to be at the same indentation level as the if


thank you, that cleared things up