12/19 loops why is this wrong error says it prints out "" instead of what it printed


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

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

#Don't delete this print statement!
print x,

#2

In Python 3, you need to wrap anything you wanna print between parentheses ( ). Also don’t miss the four space indentation per each code block, like this:

phrase = "A bird in the hand…"

for x in phrase:
  if x == "A" or x == "a":
    print("X")
  else:
    print(x)

#Don’t delete this print statement!
print(x)

Also, use double quotation marks like these " " and not like these “ ” in every string / character you wanna use.


#3

These courses are Python 2 based.

That is the only line that looks a bit off. It should not have a comma.


#4

Ah, my fault, tried to help but didn’t noticed that. :see_no_evil:


#5

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