Help with my code

Hey guys! I’m still new to coding and I’ve been trying to make a code that is sort of a game. I need help near the end where It says the variable ‘start_the_battle’ is not the defined, even though I thought I defined if above where I use it. I’ve the code below and I hope you guys are able to help. Have a good one guys!

import random
from words import monsters
print('Welcome to battle simulator')
# Instructions setup
instructions = '''This game will give you 3 weapons, It is your choice to use one of the weapons to kill each monster.
Each monster can only be killed with one weapon.if the wrong weapon is chosen, you die. Good luck hero!'''
instructions_ask = input()
if instructions_ask == 'Instructions':
    print(instructions)
# Game setup
    weapons = 'Sword', 'Bow', 'Magic'
    monster = random.choice(monsters)
    attack = input()
    start_the_battle = input()
if start_the_battle == 'Battle' 'battle':
    print('Oh no! A ' + monster + 'has appeared!')
    print(weapons)
    if attack == random.choice(weapons):
        print('You killed the monster!')

Please format your code using the </> button, as it will make it easier to determine the problem.

Double-check this line (I’m not sure if it’s just because your code is not formatted, but you are missing the or keyword).

Welcome to the forums!

1 Like

As well, as what @dr_victoria said, check this line:

Did you want to create a list of values? Remember, to create a list, you must enclose everything in square breackets []:

list_of_values = ["val1", "val2", "val3"]
1 Like