For your A (explanation request)


#1



https://www.codecademy.com/en/courses/python-beginner-en-cxMGf/1/4?curriculum_id=4f89dab3d788890003000096#


I got the answer correct, but I am wondering why the last empty print is needed, and what purpose it serves. Thanks!


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


#2

it needed for the exercise validation.


#3

So what is a good rule of thumb for us to know when we need an empty print
statement at the end?


#4

there isn't, this the only exercise where this occurs. The rule of thumb is that the print statement is already present, and there is a comment telling you not to remove the empty print statement


#5

lol, okay thank you @stetim94! It was the first time I ran into this odd thing of putting an empty print statement at the end and got confused. Thanks for clarifying!


#6

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