DEV Community


Discussion on: Daily Challenge #124 - Middle Me

citizen428 profile image
Michael Kohl

The string slicing seems to be extra effort, how about something like this?

padding = repeat * (repeat_quantity // 2)
return padding + middle + padding
Thread Thread
rafaacioly profile image
Rafael Acioly • Edited

I was looking for a even better solutions and look what i found;

fill_char = (repeat_quantity // 2) + 1
return, fill_char)