**Tell us what’s happening:**

I’m getting an import error when using this with replit, the error is on line 41

```
import random
class Hat:
def __init__(self, **kwargs):
colors = list()
for c,o in kwargs.items():
for i in range(o):
colors.append(c)
self.contents = colors
def draw(self, count):
c = 0
for i in range(len(self.contents)): c += 1
c_1 = c
c -= 1
rb = list()
for i in range(count):
if c_1 < count:
return self.contents
rb.append(self.contents.pop(random.randint(0,c)))
c -= 1
return rb
def experiment(hat, expected_balls, num_balls_drawn, num_experiments):
expected_balls = list(expected_balls.items())
m = 0
j = hat
ittm = 0
itsm = 0
for i in range(len(expected_balls)): ittm += 1
rl = dict()
for irr in range(num_experiments):
e = j.draw(num_balls_drawn)
for i in e:
rl[i] = rl.get(i, 0) + 1
rl = list(rl.items())
for g in range(len(expected_balls)):
for l in range(len(rl)):
if rl[l][0] == expected_balls[g][0] and rl[l][1] >= expected_balls[g][1]:
itsm += 1
if ittm == itsm:
m += 1
e = None
rl = dict()
return m/num_experiments
**Your code so far**
import random
class Hat:
def __init__(self, **kwargs):
colors = list()
for c,o in kwargs.items():
for i in range(o):
colors.append(c)
self.contents = colors
def draw(self, count):
c = 0
for i in range(len(self.contents)): c += 1
c_1 = c
c -= 1
rb = list()
for i in range(count):
if c_1 < count:
return self.contents
rb.append(self.contents.pop(random.randint(0,c)))
c -= 1
return rb
def experiment(hat, expected_balls, num_balls_drawn, num_experiments):
expected_balls = list(expected_balls.items())
m = 0
j = hat
ittm = 0
itsm = 0
for i in range(len(expected_balls)): ittm += 1
rl = dict()
for irr in range(num_experiments):
e = j.draw(num_balls_drawn)
for i in e:
rl[i] = rl.get(i, 0) + 1
rl = list(rl.items())
for g in range(len(expected_balls)):
for l in range(len(rl)):
if rl[l][0] == expected_balls[g][0] and rl[l][1] >= expected_balls[g][1]:
itsm += 1
if ittm == itsm:
m += 1
e = None
rl = dict()
return m/num_experiments
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`

**Challenge:** Scientific Computing with Python Projects - Probability Calculator

**Link to the challenge:**