```
spaces = {'O' : 0,
'C' : 2000,
'O' : 0,
'B' : 1750,
'O' : 0,
'A' : 1750,
'O' :0,
'O' : 0,
'O' : 0,
'E' : 1750,
'O' : 0,
'F' : 1750,
'O' : 0,
'G' : 2000,
'O' : 0
}
Towers = {'A': 1750,
'B': 1750,
'C': 2000,
'E': 1750,
'F': 1750,
'G': 2000
}
Troops = ['Dark Dragon',
'Musket',
'Archer',
'Bomb Squad',
'Ice Sage',
'White Knight',
'Royal Oger',
'Crazy Barbarian'
]
count = 0
while count < 30:
board = "|{}|{}|{}|\n" * 5
print (board.format(*spaces))
print ('Troops:')
from random import randrange
random_index = randrange(0,len(Troops))
print (Troops[random_index])
from random import randrange
random_index = randrange(0,len(Troops))
print (Troops[random_index])
from random import randrange
random_index = randrange(0,len(Troops))
print (Troops[random_index])
from random import randrange
random_index = randrange(0,len(Troops))
print (Troops[random_index])
Troop_picked = (input('Choose a troop!:'))
Tower_picked = (input('Choose a tower!:'))
count += 1
if Troop_picked == 'Dark Dragon' and Tower_picked == 'A':
Hp = Towers['A'] - 150
print ('Tower A has taken 150 damage')
elif Troop_picked == 'Dark Dragon' and Tower_picked == 'B':
Hp = Towers['B'] - 150
print ('Tower B has taken 150 damage')
elif Troop_picked == 'Dark Dragon' and Tower_picked == 'C':
Hp = Towers['C'] - 2000
print ('Tower C has taken 2000 damage')
elif Troop_picked == 'Dark Dragon' and Tower_picked == 'E':
Hp = Towers['E'] - 150
print ('Tower E has taken 150 damage')
elif Troop_picked == 'Dark Dragon' and Tower_picked == 'F':
Hp = Towers['F'] - 150
print ('Tower F has taken 150 damage')
elif Troop_picked == 'Dark Dragon' and Tower_picked == 'G':
Hp = Towers['G'] - 150
print ('Tower G has taken 150 damage')
if Troop_picked == 'Archer' and Tower_picked == 'A':
Hp = Towers['A'] - 50
print ('Tower A has taken 50 damage')
elif Troop_picked == 'Archer' and Tower_picked == 'B':
Hp = Towers['B'] - 50
print ('Tower B has taken 50 damage')
elif Troop_picked == 'Archer' and Tower_picked == 'C':
Hp = Towers['C'] - 50
print ('Tower C has taken 50 damage')
elif Troop_picked == 'Archer' and Tower_picked == 'E':
Hp = Towers['E'] - 50
print ('Tower E has taken 50 damage')
elif Troop_picked == 'Archer' and Tower_picked == 'F':
Hp = Towers['F'] - 50
print ('Tower F has taken 50 damage')
elif Troop_picked == 'Archer' and Tower_picked == 'G':
Hp = Towers['G'] - 50
print ('Tower G has taken 50 damage')
if Troop_picked == 'Musket' and Tower_picked == 'A':
Hp = Towers['A'] - 75
print ('Tower A has taken 75 damage')
elif Troop_picked == 'Musket' and Tower_picked == 'B':
Hp = Towers['B'] - 75
print ('Tower B has taken 75 damage')
elif Troop_picked == 'Musket' and Tower_picked == 'C':
Hp = Towers['C'] - 75
print ('Tower C has taken 75 damage')
elif Troop_picked == 'Musket' and Tower_picked == 'E':
Hp = Towers['E'] - 75
print ('Tower E has taken 75 damage')
elif Troop_picked == 'Musket' and Tower_picked == 'F':
Hp = Towers['F'] - 75
print ('Tower F has taken 75 damage')
elif Troop_picked == 'Musket' and Tower_picked == 'G':
Hp = Towers['G'] - 75
print ('Tower G has taken 75 damage')
if Troop_picked == 'White Knight' and Tower_picked == 'A':
Hp = Towers['A'] - 80
print ('Tower A has taken 80 damage')
elif Troop_picked == 'White Knight' and Tower_picked == 'B':
Hp = Towers['B'] - 80
print ('Tower B has taken 80 damage')
elif Troop_picked == 'White Knight' and Tower_picked == 'C':
Hp = Towers['C'] - 80
print ('Tower C has taken 80 damage')
elif Troop_picked == 'White Knight' and Tower_picked == 'E':
Hp = Towers['E'] - 80
print ('Tower E has taken 80 damage')
elif Troop_picked == 'White Knight' and Tower_picked == 'F':
Hp = Towers['F'] - 80
print ('Tower F has taken 80 damage')
elif Troop_picked == 'White Knight' and Tower_picked == 'G':
Hp = Towers['G'] - 80
print ('Tower G has taken 80 damage')
if Troop_picked == 'Bomb Squad' and Tower_picked == 'A':
Hp = Towers['A'] - 30
print ('Tower A has taken 30 damage')
elif Troop_picked == 'Bomb Squad' and Tower_picked == 'B':
Hp = Towers['B'] - 30
print ('Tower B has taken 30 damage')
elif Troop_picked == 'Bomb Squad' and Tower_picked == 'C':
Hp = Towers['C'] - 30
print ('Tower C has taken 30 damage')
elif Troop_picked == 'Bomb Squad' and Tower_picked == 'E':
Hp = Towers['E'] - 30
print ('Tower E has taken 30 damage')
elif Troop_picked == 'Bomb Squad' and Tower_picked == 'F':
Hp = Towers['F'] - 30
print ('Tower F has taken 30 damage')
elif Troop_picked == 'Bomb Squad' and Tower_picked == 'G':
Hp = Towers['G'] - 30
print ('Tower G has taken 30 damage')
if Troop_picked == 'Ice Sage' and Tower_picked == 'A':
Hp = Towers['A'] - 100
print ('Tower A has taken 100 damage')
elif Troop_picked == 'Ice Sage' and Tower_picked == 'B':
Hp = Towers['B'] - 100
print ('Tower B has taken 100 damage')
elif Troop_picked == 'Ice Sage' and Tower_picked == 'C':
Hp = Towers['C'] - 100
print ('Tower C has taken 100 damage')
elif Troop_picked == 'Ice Sage' and Tower_picked == 'E':
Hp = Towers['E'] - 100
print ('Tower E has taken 100 damage')
elif Troop_picked == 'Ice Sage' and Tower_picked == 'F':
Hp = Towers['F'] - 100
print ('Tower F has taken 100 damage')
elif Troop_picked == 'Ice Sage' and Tower_picked == 'G':
Hp = Towers['G'] - 100
print ('Tower G has taken 100 damage')
if Troop_picked == 'Royal Oger' and Tower_picked == 'A':
Hp = Towers['A'] - 120
print ('Tower A has taken 120 damage')
elif Troop_picked == 'Royal Oger' and Tower_picked == 'B':
Hp = Towers['B'] - 120
print ('Tower B has taken 120 damage')
elif Troop_picked == 'Royal Oger' and Tower_picked == 'C':
Hp = Towers['C'] - 120
print ('Tower C has taken 120 damage')
elif Troop_picked == 'Royal Oger' and Tower_picked == 'E':
Hp = Towers['E'] - 120
print ('Tower E has taken 120 damage')
elif Troop_picked == 'Royal Oger' and Tower_picked == 'F':
Hp = Towers['F'] - 120
print ('Tower F has taken 120 damage')
elif Troop_picked == 'Royal Oger' and Tower_picked == 'G':
Hp = Towers['G'] - 120
print ('Tower G has taken 120 damage')
if Troop_picked == 'Crazy Barbarian' and Tower_picked == 'A':
Hp = Towers['A'] - 45
print ('Tower A has taken 45 damage')
elif Troop_picked == 'Crazy Barbarian' and Tower_picked == 'B':
Hp = Towers['B'] - 45
print ('Tower B has taken 45 damage')
elif Troop_picked == 'Crazy Barbarian' and Tower_picked == 'C':
Hp = Towers['C'] - 45
print ('Tower C has taken 45 damage')
elif Troop_picked == 'Crazy Barbarian' and Tower_picked == 'E':
Hp = Towers['E'] - 45
print ('Tower E has taken 45 damage')
elif Troop_picked == 'Crazy Barbarian' and Tower_picked == 'F':
Hp = Towers['F'] - 45
print ('Tower F has taken 45 damage')
elif Troop_picked == 'Crazy Barbarian' and Tower_picked == 'G':
Hp = Towers['G'] - 45
print ('Tower G has taken 45 damage')
if Towers['A'] == 0:
break
print ('GAME OVER! Run again to play again.')
elif Towers['G'] == 0:
break
print ('GAME OVER! Run again to play again.')
elif Towers['A'] and Towers['B'] and Towers['C'] == 0:
break
print ('GAME OVER! Run again to play again.')
elif Towers['E'] and Towers['F'] and Towers['G'] == 0:
break
print ('GAME OVER! Run again to play again.')
```

# Error in my code where it says print(board.format(*spaces)) it is giving me an error of tuple index out of range and I do not know how to fix it

**rwyant95**#1