• + 0 comments

    from math import gcd

    def proba(n, k): count=0 dice1=range(1, n+1) dice2=range(1, n+1) for i in dice1: for j in dice2: if i + j <= k: count+=1 nbr_event = n*n

    pgcd=gcd(count, nbr_event)
    
    num=count//pgcd
    denum= nbr_event//pgcd
    
    return f"{num}/{denum}"
    

    proba(6, 9)