RASPBERRY_PYTHON Telegram 6578
🐍 Python & Raspberry 🐍
تعداد 9 توپ شامل سه توپ از رنگ های سفید، آبی و زرد به طور کاملا تصادفی بین سه نفر به طور مساوی تقسیم می کنیم. احتمال اینکه هر شخص توپ هایی از هر سه رنگ داشته باشد چقدر هست؟
from random import shuffle
from collections import Counter

def calc():
    lst = [1, 1, 1, 2, 2, 2, 3, 3, 3]
    shuffle(lst)
    partitions = [lst[i : i + 3] for i in range(0, len(lst), 3)]
    return all(len(set(sub)) == 3 for sub in partitions)

n = 100_000
c = Counter(calc() for _ in range(n))
print(round(c[True] / n, 2))

@AmirSoroushh
👍4🍾2



tgoop.com/raspberry_python/6578
Create:
Last Update:

from random import shuffle
from collections import Counter

def calc():
    lst = [1, 1, 1, 2, 2, 2, 3, 3, 3]
    shuffle(lst)
    partitions = [lst[i : i + 3] for i in range(0, len(lst), 3)]
    return all(len(set(sub)) == 3 for sub in partitions)

n = 100_000
c = Counter(calc() for _ in range(n))
print(round(c[True] / n, 2))

@AmirSoroushh

BY 🐍 Python & Raspberry 🐍


Share with your friend now:
tgoop.com/raspberry_python/6578

View MORE
Open in Telegram


Telegram News

Date: |

4How to customize a Telegram channel? Some Telegram Channels content management tips The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. Deputy District Judge Peter Hui sentenced computer technician Ng Man-ho on Thursday, a month after the 27-year-old, who ran a Telegram group called SUCK Channel, was found guilty of seven charges of conspiring to incite others to commit illegal acts during the 2019 extradition bill protests and subsequent months. According to media reports, the privacy watchdog was considering “blacklisting” some online platforms that have repeatedly posted doxxing information, with sources saying most messages were shared on Telegram.
from us


Telegram 🐍 Python & Raspberry 🐍
FROM American