def swap(ch, i, j):
temp = ch[i]
ch[i] = ch[j]
ch[j] = temp
def findperm(sl, ind=0):
if ind == len(sl) - 1:
print(''.join(sl))
for i in range(ind, len(sl)):
swap(sl, ind, i)
findperm(sl, ind + 1)
swap(sl, ind, i)
strg = 'ABC'
findperm(list(strg))
#Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP