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,
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.
These courses are Python 2 based.
That is the only line that looks a bit off. It should not have a comma.
Ah, my fault, tried to help but didn’t noticed that.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.