# Scientific Computing with Python Projects - Probability Calculator

Tell us what’s happening:
I am trying to do **kwargs. I don’t understand what am I suppose to do here, can I get a hint of what am I supposed to do here

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

Challenge: Scientific Computing with Python Projects - Probability Calculator

@chiragy942 do you mean you don’t understand how `**kwargs` works?

Or, do you mean you don’t know what do you need to do to complete this challenge?

I am trying to do
holder = Hat(expected_balls)
and it is giving me
TypeError: Hat.init() takes 1 positional argument but 2 were given
but in Hat class I am using **kwargs is expected_balls not an keyword arguement?

I see.

Can you please paste here a portion of your code that causes this error.

def experiment(hat, expected_balls, num_balls_drawn, num_experiments):
store =
counter = 0
newHat = Hat(expected_balls)
for pulls in num_experiments:
storeHat = hat
storeHat.contents = random.shuffle(storeHat.contents)
tempHolder = storeHat.draw(num_balls_drawn)
for items in tempHolder:
newCounter = 0
for things in newHat.contents:
if items == things:
newCounter += 1
if newCounter == len(newHat.contents):
counter += 1
newCounter = 0
store.append(tempHolder)
return counter/len(store)

the error occers in
newHat = Hat(expected_balls)

if you want I can send you the replit link as well

So, in `main.py`

Your `prob_calculator.experiment` method is receiving named (keyword) arguments.

But in `prob_calculator.py`, the `experiment` method is expecting to receive positional arguments.

1 Like

thanks :slight_smile

1 Like

So, the solution is to change your expected arguments to `**kwargs` aka named (keyword) arguments in your `experiment` method definition.