Home > Software engineering >  Why there is space and p in last line in output?
Why there is space and p in last line in output?

Time:05-25

a = "ns "
for i in  a:
    print(i,end = "p\n")

this is the output Why there is space and p in last line in output ????

CodePudding user response:

It is because your string contains a space and \n is treated as a line break, leaving a p at the end of each line.

  • Related