Q:

Write a Python program to get a single string from two given strings, separated by a space and swap the first two characters of each string

0

Write a Python program to get a single string from two given strings, separated by a space and swap the first two characters of each string

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def chars_mix_up(a, b):
  new_a = b[:2] + a[2:]
  new_b = a[:2] + b[2:]

  return new_a + ' ' + new_b
print(chars_mix_up('abc', 'xyz'))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now