+ 5

[SOLVED]What's the difference between sep and end?

What's the difference between sep and end in python, and when should they be used?

21st Jun 2018, 6:11 PM
LONGTIE👔
LONGTIE👔 - avatar
5 Réponses
+ 9
used like this print(1,2,3,sep="
quot;) >>> 1$2$3 print(1,2,3,end="
quot;) >>> 1 2 3$ print(1,2,3,end="
quot;) print(1,2,3,end="
quot;) >>> 1 2 3$1 2 3$
21st Jun 2018, 6:22 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 3
LONGTIE edited
21st Jun 2018, 6:24 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 3
Abdur's answer apparently disappeared so here's my answer: sep is the separator between any 2 things. end is the one that comes after the last thing has been printed.
13th Jan 2020, 10:06 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Abdur-Rahmaan Janhangeer why dose the last line not end with $?
21st Jun 2018, 6:23 PM
LONGTIE👔
LONGTIE👔 - avatar
21st Jun 2018, 6:25 PM
LONGTIE👔
LONGTIE👔 - avatar