Tell us what’s happening:
I’m not sure how to deal with the parameters they provide me
hat = prob_calculator.Hat(blue=4, red=2, green=6)
because they’re not strings and I can’t use the split methode.
Here’s what i’ve tried
class Hat:
def __init__(self, *args):
self.contents = []
for arg in args:
n = int(arg.split('=')[1])
for i in range(n):
self.contents.append(arg.split('=')[0])
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Challenge: Probability Calculator
Link to the challenge: