Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
How many lines does this program show, counting a blank line as a line?
end="" keeps the next print() on the same line.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
print("a") shows a and moves to a new line. (1 line)print() shows a blank line. (2 lines)print("b", "c") shows b c. (3 lines)print("d", end="") shows d and does not move to a new line.print("e") continues on the same line: de. (4 lines)Answer: four lines: a, a blank line, b c and de.
Log in to join the discussion.
Loading…