-1
我在第27行有這個非常奇怪的問題:Syntax Error: can't assign to operator
。我不知道爲什麼會發生,我花了幾個小時在本網站上搜索答案,但沒有任何幫助。該計劃是在發展的早期階段,所以這將是冷靜,如果你能幫助我做一些更多的問題,你會發現:語法錯誤:無法分配給運營商
from time import sleep
from random import randint
print("Welcome to a text version of World of Tanks. Choose your tank: PzII(1) T-26(2) CruiserIII(3) Ha-Go(4) M2 Light(5)")
Tank="PzII"
shoot_PzII(Tank)
if(Damage_Approved):
print("You dealt",Damage_To_Enemy,"points of damage to the enemy.")
else:
print("You didn't penetrate enemy armour.")
#PzII
Hitpoints=260
Accuracy_PzII_IN%=80
Penetration_PzII=49
Damage_PzII=range(9,15)
Armor_Front_PzII=30
Armor_SIdes_PzII=20
Armor_Rear_PzII=15
Armor_Front_Turret_PzII=30
Armor_Sides_Turret_PzII=20
Armor_Rear_Turret_PzII=20
#PzII Enemy
Hitpoints_Enemy=260
Accuracy_PzII_IN%_Enemy=80
Penetration_PzII_Enemy=range(29,49)
Damage_PzII_Enemy=range(9,15)
Armor_Front_PzII_Enemy=30
Armor_SIdes_PzII_Enemy=20
Armor_Rear_PzII_Enemy=15
Armor_Front_Turret_PzII_Enemy=30
Armor_Sides_Turret_PzII_Enemy=20
Armor_Rear_Turret_PzII_Enemy=20
def shoot_PzII(Tank):
Shot_land_n=randint(0,2)
if(Tank=="PzII"):
if(Shot_land_n==1):
Shot_land=Turret
Accuracy_PzII_IN%_InSituation=Accuracy_PzII_IN%-(Distance_To_Enemy/2)
if(randint(0,100)<=Accuracy_PzII_IN%_InSituation):
If_Try_Damage=True
else:
If_Try_Damage=False
if(If_Try_Damage):
if(Penetration_PzII>Armor_Front_Turret_PzII_Enemy):
Damage_To_Enemy=randint(Damage_PzII)
Damage_Approved=True
Hitpoints_Enemy=Hitpoints_Enemy-Damage_To_Enemy
else:
Damge_Approved=False
登錄標識符是否是否定的。 –
'%'是一個模操作 - >標識符中的否定。 – 2016-12-24 20:07:59