12. For your A


#1

Good Day

Please could someone help me?
My code is as follows:

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

It keeps returning the following error. I don’t know what it wants with me.

Did you replace all of the "A"s and "a"s with "X"s? It looks like you printed “X bird in the hXnd…” instead of “X b i r d i n t h e h X n d . . .”.


#2

Would you mind providing a link to the lesson?


#3

Hi Goku :slight_smile:

Thank you, I solved it.
My output was printing it out letter by letter and wanted it as a line.
It was solved by adding “,” at the end of my print statement.

Kind Regards


#4

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