Python program to concatenate two strings using recursion

Concat() is a recursive function that takes two alphabetically ordered strings and merges them.

def Concat(a, b):
if a:
if b:
if a[:1] < b[:1]:
return a[:1] + Concat(a[1:], b)
return b[:1] + Concat(a, b[1:])
return a
return b
print(Concat('Web','educlick'))

Output:
Webeduclick