15,847,653 members
See more:
```# evenList = ['GAAGCTCG', 'AAATTT', 'CTCTAGGAC']
# oddList = ['CCTCGGGA', 'GGGCCC', 'GAGTACCTG']

def matchList(evenList, oddList, integ):
indexElement = 0
indexList = 0
totalIndexSeq = []
acceptableList = ['AT', 'TA', 'at', 'ta', 'GC', 'CG', 'gc', 'cg']

for x in evenList:
indexedSeq = ''

for y in x:
if y + oddList[indexList][indexElement] in acceptableList:
indexedSeq += str(indexElement)
else:
indexedSeq += "+"
indexElement += 1

indexList += 1
indexElement -= indexElement
totalIndexSeq.append(indexedSeq)
# This is what is returned:
# ['0+234+6+']
# ['0+234+6+', '++++++']
# ['0+234+6+', '++++++', '012++5678']```

What I have tried:

I'm new to coding and just now learning recursion. Any tips and/or advice would be appreciated.
Posted
Updated 20-Apr-19 16:58pm
Richard MacCutchan 21-Apr-19 4:55am
Same comment as in your other question. Recursion is not a universal solution to every problem.

## Solution 1

Quote:
I'm new to coding and just now learning recursion.

First of all, you need to learn what is recursive, how to recognize a recursive problem/algorithm. When a problem os not recursive by nature, it is a no go.
"Recursion occurs when a thing is defined in terms of itself or of its type."
Recursion - Wikipedia[^]
Quote:
How do I perform this function recursively?

Not all problems are defined in terms of recursive, and I don't see anything recursive in this code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 125 0x01AA 65 #realJSOP 40 Maxim Kartavenkov 40 CPallini 10
 OriginalGriff 2,218 Richard Deeming 875 Dave Kreskowiak 641 Graeme_Grant 589 Richard MacCutchan 510

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900