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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

TypesError:+ 不支持的操作數(shù)類型:'int' 和 'tuple'

TypesError:+ 不支持的操作數(shù)類型:'int' 和 'tuple'

ibeautiful 2023-02-22 16:32:28
我正在嘗試制作劊子手,但出現(xiàn)以下錯誤:我試圖讓它返回 pos_ 的 x 坐標(biāo)。包含錯誤的代碼片段:        def DrawLetter(IndexNumber):        if letterlist[x-1] == "g":            pos_ = (AdjustMe + (27 * int(IndexNumber), 226))        else:            pos_ = (AdjustMe + (27 * int(IndexNumber), 230))        screen.blit(letter, pos_)        screen.blit(BottomDashes, (0, 256))        lettersguessed.append(letterlist[x-1])        print(x)        if LTGL == lettersguessed:            print("you won")            running = False    while x < len(letterlist):        duplicates = [item for item, count in collections.Counter(word).items() if count > 1]        if letterlist.count(letterlist[x-1]) > 1:            for y in duplicates:                DuplicatesList = [i for i, e in enumerate(word) if e == y]            IndexNumber = list(DuplicatesList)            print(IndexNumber)            DrawLetter(IndexNumber)        else:            IndexNumber = LTGL.index(letterlist[x - 1])            DrawLetter(IndexNumber)        x += 1如果有人可以指出一些不遵循 PEP8 的代碼,則會加分。另外,請注意這還遠未完成,因此如果有一些代碼作為注釋,我稍后會刪除它們。
查看完整描述

1 回答

?
Cats萌萌

TA貢獻1805條經(jīng)驗 獲得超9個贊

這里:


pos_ = (AdjustMe + (27 * int(IndexNumber), 226))

是相同的:


pos_ = (int + (int * int, int)) ->

       (int + tuple)

python 應(yīng)該如何將該整數(shù)添加到該元組?


這是更正的方法:


if letterlist[x-1] == "g":

    pos_ = (27 * int(IndexNumber) + AdjustMe, 226 + AdjustMe)

else:

    pos_ = (27 * int(IndexNumber) + AdjustMe, 230 + AdjustMe)


查看完整回答
反對 回復(fù) 2023-02-22
  • 1 回答
  • 0 關(guān)注
  • 116 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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