Skip to content
← Back to Community
5.3. Strings: Two halves
Profile icon
pole55

"""Given a string, cut it into two equal parts. If the length of the string is odd, leave the middle character within the first chunk, so that the first string contains one more character than the second. Now print a new string on a single row with the first and second halves swapped: second half first and the first half last.

Can you solve it without using if?"""

Voters
Profile icon
VaibhavKarale
Profile icon
kenclassical
Profile icon
410722002
Profile icon
Nightmare1
Profile icon
MarielaL2773
Profile icon
ToluwaniOdubade
Profile icon
tomsfy
Profile icon
HenryWest
Profile icon
ClobberDobber
Profile icon
mahnoorfakhar