Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. def Solution(DNA_seq="", p_array=[], q_array=[], M=0):
- 2. ans = []
- 3. K = 0 #Counter Variable to track current position of decrypting
- 4. while K < M:
- 5. #Split the string at required locations
- 6. seq = DNA_seq[p_array[K]:q_array[K]+1]
- 7. if 'A' in seq:
- 8. ans.append(1)
- 9. elif 'C' in seq:
- 10. ans.append(2)
- 11. elif 'G' in seq:
- 12. ans.append(3)
- 13. elif 'T' in seq:
- 14. ans.append(4)
- 15. K += 1
- 16.
- 17. print(ans)
- 18. return ans
- 19.
- 20.
- 21.
- 22. seq1 = "CAGCCTA"
- 23. p = [2, 5, 0]
- 24. q = [4, 5, 6]
- 25. M = 3
- 26. Solution(seq1, p, q, M)
- RAW Paste Data
- def Solution(DNA_seq="", p_array=[], q_array=[], M=0):
- ans = []
- K = 0 #Counter Variable to track current position of decrypting
- while K < M:
- #Split the string at required locations
- seq = DNA_seq[p_array[K]:q_array[K]+1]
- if 'A' in seq:
- ans.append(1)
- elif 'C' in seq:
- ans.append(2)
- elif 'G' in seq:
- ans.append(3)
- elif 'T' in seq:
- ans.append(4)
- K += 1
- print(ans)
- return ans
- seq1 = "CAGCCTA"
- p = [2, 5, 0]
- q = [4, 5, 6]
- M = 3
- Solution(seq1, p, q, M)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement