第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

cs50 dna 當(dāng)我調(diào)試我的代碼時(shí)我得到了這個(gè)錯(cuò)誤

cs50 dna 當(dāng)我調(diào)試我的代碼時(shí)我得到了這個(gè)錯(cuò)誤

慕碼人2483693 2023-06-20 16:12:36
這是我的代碼,好的,我知道我的代碼在算法上有 o^234234324 復(fù)雜性,但它適用于除 sequences/15.txt 和 sequences/16.txt 之外的所有序列import sysimport csvif len(sys.argv) != 3:    print("useage: filenameofdata.cvs filenameofsequence.txt")    sys.exit(1)with open(sys.argv[1], "r") as datafile:    readdata = list(csv.reader(datafile))with open(sys.argv[2], "r") as sequencefile:    readsequence = list(csv.reader(sequencefile))strs = list(readdata[0][1:])conlist = []dnanum = 0for move in (strs):    sequence = list(readsequence[0][0])    consecutively = 0    l = len(move)    cursor = [None] * 2    temp = [None] * l    x = 0    counter = 0    while counter == 0:        if sequence == []:            conlist.append(consecutively)            break        for oneletter in (sequence):            if x < 2:                cursor[x] = oneletter            temp[x] = oneletter            x += 1            if x == l:                asstring = ''.join(map(str, temp))                if asstring == move:                    dnanum += 1                    move                    temp = [None] * l                    x = 0                    continue                else:                    if consecutively < dnanum:                        consecutively = dnanum                    oneletter = sequence.remove(cursor[0])                    temp = [None] * l                    x = 0                    dnanum = 0                    break# this print was for check if i got the right str consecutivelyprint(conlist)conlist = ''.join(map(str, conlist))for y in readdata:    x = ''.join(map(str, y[1:]))    if conlist == x:        print(y[0])        sys.exit(1)print("No match")當(dāng)我嘗試在 sequences/15.txt 和 sequences/16.txt 中調(diào)試它時(shí),或者如果我嘗試運(yùn)行它們,我在調(diào)試時(shí)沒有輸出按摩錯(cuò)誤
查看完整描述

1 回答

?
揚(yáng)帆大魚

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊

那太復(fù)雜了。為了獲得每個(gè)STR的最大連續(xù)STR數(shù),我只寫了6行代碼:


for i in range(1, len(data[0])):  # loop through all STR


    count = 1


    string = data[0][i]  # assign each STR to a string


    while string * count in dna:  # if find 1 string, then try to find string*2, and so on


        count += 1


    counts.append(str(count - 1))  # should be decreased by 1 as initialized to 1


查看完整回答
反對(duì) 回復(fù) 2023-06-20
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)