user13664591
user13664591

Reputation:

Why does this code add an additional empty line when using "\n"?

I´m asking about the reason why there is a empty line after printing second block of code.

Code:

    print ('a','b', end='', sep='**')
    print('c')

Output:

a**bc

Code:

    print ('a','b', end='', sep='**')
    print ('\n')
    print ('c')

Output:

a**b

c

Upvotes: 0

Views: 42

Answers (1)

Cailean Oikawa
Cailean Oikawa

Reputation: 11

the default for print is end='\n' so the second line is actually \n\n try using the end='' like you did in the first line

Upvotes: 1

Related Questions