Why does
print("\n")
print two lines worth of space and not one as I anticipated it would?
print(“x”)
print("\n")
print(“y”)
results in:
x
(empty line of space)
(empty line of space)
y
and not:
x
(empty line of space)
y
Why does
print("\n")
print two lines worth of space and not one as I anticipated it would?
print(“x”)
print("\n")
print(“y”)
results in:
x
(empty line of space)
(empty line of space)
y
and not:
x
(empty line of space)
y
>>> print('x');print();print('y')
x
y
>>>
>>> print('x');print('\n');print('y')
x
y
>>>
print()
by itself takes a separate line. We can conclude that Python is inserting a newline
at the end, so printing one means there are now two.