So I am trying to create a function that will let me simply call the function, and I give it 10 values, and a variable, and it will change that variable into one of the values provided, randomly.
import random
place = "NA"
def randomize (value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, variable):
global variable
variable = random.choice([value1, value2, value3, value4, value5, value6, value7, value8, value9, value10])
randomize ("Dungeon", "Plains", "Castle", "Prison", "Tavern", "Armory", "Docks", "Warehouse", "ThroneRoom", "Bedroom", place)
print place
This however tells me the following:
SyntaxError: name 'variable' is local and global