-1

I'm quite new to python and i would like to split a string of numbers like "12" or "1234" in two parts by separating the string in the middle with " ". e.g.: "12" --> "1 2", "1234" --> "12 34"

How can i do this? I've tried it multiple times with split() now and I just don't make it

Pseudocode:

split("12")

result = "1 2"

1 Answers1

1

one way to do that

a = '1234'
splitter = len(a)//2
print(a[:splitter], a[splitter:])
Tauqeer Sajid
  • 101
  • 1
  • 1
  • 10