Initial commit

This commit is contained in:
2024-03-11 12:43:52 +02:00
parent 0cc291f3d8
commit a57340adb7
55 changed files with 2961 additions and 1 deletions

12
Python/code_cycle.py Normal file
View File

@@ -0,0 +1,12 @@
total_attempts = 256*256*256
successful_attempts = 0
for a in range(0, 256):
for b in range(0, 256):
for c in range(0, 256):
if a + b + c > 300:
successful_attempts += 1
print(f"Iterations: {total_attempts}")
print(f"Valid sums: {successful_attempts}")
print(f"Probability: {successful_attempts / total_attempts}")

View File

@@ -0,0 +1,17 @@
from random import randint
total_attempts = 15_000_000
successful_attempts = 0
for i in range(0, total_attempts):
a = randint(0, 256)
b = randint(0, 256)
c = randint(0, 256)
if a + b + c > 300:
successful_attempts += 1
print(f"Iterations: {total_attempts}")
print(f"Valid sums: {successful_attempts}")
print(f"Probability: {successful_attempts / total_attempts}")