Question 9: Why do some rows need print() to go to the next line while the other don't?
Why do some rows need "print()" to go to the next line while the others don't?
1 answers ( 0 marked as helpful)
Hey Sachintha,
Thank you for reaching out!
Consider the following example:
In the first print, we have told Python to print out the letter 'a' and then leave an empty space. The next print, which will be 'b', will therefore end up next to 'a'. However, if we don't tell Python explicitly to put 'b' next to 'a', it will put it on a new line. That's exactly what happens with the letter 'c'. By default, the print function prints on a new line, unless told otherwise.
Here is a commented version of the code provided by Giles.
Hope this helps!
Kind regards,
365 Hristina