From 4336ff576ed32a366ea0354db49779e9c1fadae5 Mon Sep 17 00:00:00 2001 From: Daniel <59575049+lemoentjiez@users.noreply.github.com> Date: Thu, 3 Nov 2022 12:35:14 +0200 Subject: [PATCH] Create bonus_psa.py --- LabPSA_1/bonus_psa.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 LabPSA_1/bonus_psa.py diff --git a/LabPSA_1/bonus_psa.py b/LabPSA_1/bonus_psa.py new file mode 100644 index 0000000..dabcfb8 --- /dev/null +++ b/LabPSA_1/bonus_psa.py @@ -0,0 +1,8 @@ +import random +from PIL import Image + +img = Image.open("bonus.png").convert('RGB') +w, h, c = img.width, img.height, 0 +for _ in range(100000): + c = c + 1 if img.getpixel((random.randint(0, w - 1), random.randint(0, h - 1))) == (255, 0, 0) else c +print(c/100000 * 42)