0

我在输入两个 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()
4

1 回答 1

0

它可能是这样的:

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()
于 2013-11-02T22:36:06.930 回答