Adding random object every time you press the same key
When you add a sensor, you need to eval if its active in the script so you can do stuff.

To evalute the keyboard sensor named &quot;Keyboard&quot;
from bge import logic
import random

keysensor = logic.getCurrentController().sensors['Keyboard']
scene = logic.getCurrentScene()
own = logic.getCurrentController().owner
list = ['Cube','etc']
'''Eval if sensor activated'''
if keysensor.positive:
    choice = random.choice(list)
    scene.addObject(choise, own, 100)

EDIT
To properly use scene.addObject the object has to be in an inactive layer
see objectsInactive

And the script to work properly.
from bge import logic
import random

keysensor = logic.getCurrentController().sensors['Keyboard']
scene = logic.getCurrentScene()
own = logic.getCurrentController().owner
list = scene.objectsInactive
'''Eval if sensor activated'''
if keysensor.positive:
    choice = random.choice(list)
    scene.addObject(choice, own, 100)

ObjectsInactive is a list of all objects who are in an inactive layer, so if you need just some of the objects yo can add a property to the objects so you can gather them easy.


Then change
list = scene.objectsInactive

for
list = [obj for obj in scene.objectsInactive if 'spawnObj' in obj.getPropertyNames()]

That way the list would be fill with objects that have a property named &quot;spawnObj&quot;.
Finally use descriptive names for the sensors, instead keyboard, keyboard.001, keyboard.002, ect... SpaceKey, aKey, BKEY, ckey, etc..
Demo file: