For your A


#1



HI i have a concept clarification

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


Why is there print keyword at the end of this program?

When I remove the print keyword I get the following error:
Oops, try again. 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 . . .".


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  
** I'm talking about the above print keyword **


#2

Because at the end of the program this line prints a newline character that moves the cursor and start of next output to the next line.

Notice that the print statements in the program end with a comma? That tells the pencil to stay on that line, at its current print position. A space character is inserted before the next output.


#3

Oh okay
Thank you very much.


#4

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