Python 匹配两个RNA序列并打印出匹配碱基对长度的程序

Python 匹配两个RNA序列并打印出匹配碱基对长度的程序,python,string,list,Python,String,List,我在一个程序中遇到了一些问题,在这个程序中,你输入两个RNA序列,然后打印出匹配碱基对的长度 以下是我目前掌握的情况: def main(): Sequence1 = "" Sequence2 = "" print("MatchSequences(Sequence1,Sequence2)") MatchSequence = input("Enter the subsequences with each base in single quotes and the

我在一个程序中遇到了一些问题,在这个程序中,你输入两个RNA序列,然后打印出匹配碱基对的长度

以下是我目前掌握的情况:

def main():

    Sequence1 = ""
    Sequence2 = ""
    print("MatchSequences(Sequence1,Sequence2)")
    MatchSequence = input("Enter the subsequences with each base in single quotes and the subsequences separated a comma")
    input = (x,y)
    x = ([])
    y = ([])
    for i in range(0,len(Sequence1)):
        if x == A

main()

可能是这样的:

from string import join

def main():
    pairs = {'G':'C', 'C':'G', 'A':'U', 'U':'A'}
    print("MatchSequences(Sequence1, Sequence2)")
    x, y = input("Enter the subsequences with each base in single quotes and the subsequences separated a comma")
    matched = join([a  if pairs[a]==b else '-' for (a, b) in zip(x, y)], sep='')

if __name__=='__main__':
    main()

好的,但是A和U需要匹配,G和C也需要匹配。