解释这个语法错误

时间:2013-12-10 23:40:39

标签: python syntax

有谁能告诉我为什么会出现语法错误?我以前运行过这个确切的代码,它完美无缺。 强文本中的行是Python告诉我语法错误的地方。谢谢大家!

import random

count = 0
while count < 10:

    attackerLV = 20
    attackerST = 20
    attackerSK = 20
    baseAtkPwr = 20
    attackPWR = ((random.randint(85,100) * (baseAtkPwr + attackerLV + attackerST + attackerSK)) // 100

    **defenderLV = 20**
    defenderCON = 20 
    defenderSKa = 20
    baseDefPwr = 20
    defensePWR = (((random.randint(85,100)) * (baseDefPwr + defenderLV + defenderCON + defenderSKa)) // 4) // 100

    damage = attackPWR - defensePWR

    if damage <= 1:
        damage = 1

    print(str(attackPWR))
    print(str(defensePWR))
    print(str(damage))
    print()

    count = count + 1

1 个答案:

答案 0 :(得分:5)

你错过了一个括号:

attackPWR = ((random.randint(85,100) * (baseAtkPwr + attackerLV + attackerST + attackerSK)) // 100