For your A


HI i have a concept clarification

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',
        print char,

#Don't delete this print statement!
** I'm talking about the above print keyword **


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.


Oh okay
Thank you very much.


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