So, im on holiday and decided to take my laptop to do some small coding, but i'm stuck on something,
I'm creating a small game, a simple text game and I was wondering if I could make a varible true/false randomly
so for example:
If you were searching for an item, but there was a 50/50 chance of that item appearing, what would be the code for that variable to be true/false and be recognizable.
EG CODE
def monster():
print("You search for monsters")
command = prompt() # It lets you type in a command
if command == True:
print("You find a monster")
monsterbattle()
if command == False:
print("You don't find a monster")
home()
I'm hoping the code can be somewhere else, like at the start that randomly makes it true/false somehow
/help