import random
def birth():
month=random.randint(1,12)
if month==[1,3,5,7,8,10,12]:
date=random.randint(1,31)
elif month==2:
date=random.randint(1,28)
else:
date=random.randint(1,30)
birthday=(month+0.01*date)
return birthday
counts=0
for frequence in range(100000):
box=set()
for i in range(23):
box=box.add('birth()')
if len(box)!=23:
counts+=1
print('{:.5%}'.format(counts/100000))
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\python\Unit6.py", line 18, in
box=box.add('birth()')
AttributeError: 'NoneType' object has no attribute 'add'