My code is right but still showing error message


#1

https://www.codecademy.com/courses/learn-python/lessons/loops/exercises/for-your-a?action=resume_content_item


#2

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,
 

#3
#Don't delete this print statement!
print

where did this print statement go? The comment at the beginning of the lesson explicitly says not to remove it


#4

same code I wrote but still it is showing error as "Did you replace all of the "A"s and "a"s with “X"s? It looks like you printed “” instead of “X b i r d i n t h e h X n d . . .”.”


#5

where is your third print statement then? The one you where told not to remove, without the third print statement you will get that error

after the loop you need a third print statement for validation purpose, its mentioned somewhere


#6

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