0

2 つの 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 に答える