Help with test 3 in


I need some help to understand why my app is failing. Not an expert on random.
I’m getting very different results from my computer to
My comp is always around 0.27 and is 0.17. but I have no idea how to improve those results.

This is my code:>

def draw(self, numero):
    cantidad = self.bolasTotales - numero
    if (cantidad < 0):
        return self.contents
    bolas = []
    for i in range(numero):
        indice = random.randint(0, len(self.contents)-1)
        bola = self.contents.pop(indice)
    return bolas

Full code>

Ideas welcome.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0.

Challenge: Probability Calculator

Link to the challenge:

If I run your code the only failure is that you return a string instead of a number.
Changing that passes all the tests without issue.

1 Like

I can’t believe was that. Thanks!! :star_struck: