-3

何らかの理由で、リストにゼロ以外の数値が含まれているにもかかわらず、私のスクリプトはすべての値をゼロとして出力しています。

#this is the specific part of my script, A, T, G % C are 4 lists that consists from 10 indexes, each of which is a different number

 for i in range(min(len(A), len(G), len(C), len(T))):
    A1=A[i]*3/100
    C1=C[i]*3/100
    G1=G[i]*3/100
    T1=T[i]*3/100

    tA.append(A1)
    tC.append(C1)
    tG.append(G1)
    tT.append(T1)

    i=i+1

print "       A        C        T        G"
print "143   %d       %d       %d       %d" %(tA[0],tC[0],tT[0],tG[0])
print "144   %d       %d       %d       %d" %(tA[1],tC[1],tT[1],tG[1])
print "145   %d       %d       %d       %d" %(tA[2],tC[2],tT[2],tG[2])
print "146   %d       %d       %d       %d" %(tA[3],tC[3],tT[3],tG[3])
print "147   %d       %d       %d       %d" %(tA[4],tC[4],tT[4],tG[4])
print "148   %d       %d       %d       %d" %(tA[5],tC[5],tT[5],tG[5])
print "149   %d       %d       %d       %d" %(tA[6],tC[6],tT[6],tG[6])
print "150   %d       %d       %d       %d" %(tA[7],tC[7],tT[7],tG[7])
print "151   %d       %d       %d       %d" %(tA[8],tC[8],tT[8],tG[8])
print "152   %d       %d       %d       %d" %(tA[9],tC[9],tT[9],tG[9])
print "153   %d       %d       %d       %d" %(tA[10],tC[10],tT[10],tG[10])

私の出力は以下の通りです:

       A        C        T        G
143   0       0       0       0
144   0       0       0       0
145   0       0       0       0
146   0       0       0       0
147   0       0       0       0
148   0       0       0       0
149   0       0       0       0
150   0       0       0       0
151   0       0       0       0
152   0       0       0       0
153   0       0       0       0

なんで全部0なの?

4

2 に答える 2

2

に変換するか、最初のインポートとして次のことを行うことができintegersますfloats

from __future__ import division
于 2013-08-21T13:21:22.587 に答える