HOW THIS CODE WORKS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HOW THIS CODE WORKS

x=(1,2,3) print(*x,sep="1",end="3")

20th May 2021, 4:23 AM
Somil Khandelwal
2 Answers
+ 4
*x => unpacking tuple => 1 2 3 sep = "1" => separator of argument => 11213 end="3" => end argument of print() => 112133
20th May 2021, 4:33 AM
TOLUENE
TOLUENE - avatar
+ 1
*x unpacks the tuple as: 1 2 3 sep is a separator filling the gap (space) between the numbers with `1`: 11213 end prints a `3` at last Hence the output: 112133
20th May 2021, 4:34 AM
Infinity
Infinity - avatar