I'm trying to achieve the next thing. When I put the s
as a string such as "Hello"
, I want it to split for the number in part_length
. Meaning that if I put 1
in part_length
, the operation result would be: "H e l l o s"
, if I put 2
in part_length
, it would print "He ll os"
This is the code I have now:
def split_in_parts(s, part_length):
for num in range(part_length):
print(split_in_parts("Hellos", 1))
But I can't figure out how to split the words according to the numbers, which I believe I lack the knowledge in commands. I've tried commands such as ' '.join()
but in that case it separates in a way that it is not accordingly to the numbers.