Home > Net >  problem solved = Python using different module package , and counts ; please help me derive the co
problem solved = Python using different module package , and counts ; please help me derive the co

Time:04-15

problem solved ! thank you everyone for your help

CodePudding user response:

I think the problem is this part of the code:

for i in range(1000):
    result = yut.throw_yut4

    back = yut.throw_yut4().count('등') 
    belly = yut.throw_yut4().count('배')

Seems like it should be:

for i in range(1000):
    result = yut.throw_yut4()

    back = result.count('등') 
    belly = result.count('배')

Otherwise you are counting back/belly from independent yut.throw_yut4() calls, so some unhandled (and presumably unintended) results are possible like back=4 and belly=4 ... this is why the totals you count are less than 1000 and 100%

CodePudding user response:

It seems like your counts dictionary isn't getting filled with 1000 elements. It is likely because you are calling the yut.throw_yut4() twice, which give different results, such that none of your conditional checks pass.

try this instead:

result = yut.throw_yut4()
back = result.count('등')
belly = result.count('등')

천만에요

  • Related