Jan-20-2019, 10:21 PM
With your existing code, you just need to change the parentheses to square brackets in the return. However, it would be more straightforward to use random.choice() instead:
def obtenerPalabraAlAzar(listaDePalabras): indiceDePalabras = random.randint(0,len(listaDePalabras)-1) return listaDePalabras[indiceDePalabras] # or def obtenerPalabraAlAzar(listaDePalabras): return random.choice(indiceDePalabras)