+ 1

something is not right

print("1,2,3,4".join("/")) output: /

8th Jun 2020, 9:45 PM
sofronis
sofronis - avatar
4 odpowiedzi
+ 4
join stops before the last string so "1,2,3,4" won't join this("/") if it was "1,2,3,4".join("//") then it would have joined in between those two slashes
8th Jun 2020, 9:49 PM
Abhay
Abhay - avatar
+ 2
Try: print("/".join(("1", "2", "3", "4")))
8th Jun 2020, 9:58 PM
Seb TheS
Seb TheS - avatar
+ 1
What output are you look for?
8th Jun 2020, 9:53 PM
rodwynnejones
rodwynnejones - avatar
+ 1
print("/".join("1,2,3,4".split(','))) # or print("1,2,3,4".replace(',', '/'))
8th Jun 2020, 10:02 PM
rodwynnejones
rodwynnejones - avatar