C:\> Rostislav Persion's Projects

.:: Birthday Paradox ::.
Python Birthday Paradox Simulator


This is a Python program that simulates the "Birthday Paradox". If you have 23 people in a group, then the chance of two people having a birthday ont he same day is 50%. This program simulates the problems and gives statistical results.

RESULTS:

2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
4 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
3 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
3 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
3 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
2 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
4 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
1 BIRTHDAY MATCHES FOUND IN A GROUP OF 23!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!
NO BIRTHDAY MATCHES FOUND!

107 WINS AND 92 LOSSES.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import datetime
import random

#keep track of wins and losses
wins = 0
losses = 0

for mainloop in range(1,200):

    datelist = []

    for x in range(0,23):
        month = random.randint(1, 12)
        if month == 1:
            day = random.randint(1, 31)
        if month == 2:
            day = random.randint(1, 28)
        if month == 3:
            day = random.randint(1, 31)
        if month == 4:
            day = random.randint(1, 30)
        if month == 5:
            day = random.randint(1, 31)
        if month == 6:
            day = random.randint(1, 30)
        if month == 7:
            day = random.randint(1, 31)
        if month == 8:
            day = random.randint(1, 31)
        if month == 9:
            day = random.randint(1, 30)
        if month == 10:
            day = random.randint(1, 31)
        if month == 11:
            day = random.randint(1, 30)
        if month == 12:
            day = random.randint(1, 31)
        datelist.append(datetime.datetime(2020, month, day))

    Count = 0

    for a in range(0,23):
        for b in range(0,23):
            if (datelist[a] == datelist[b]) and (a != b):
                Count += 1

    Count = Count / 2

    if Count >  0:
        wins += 1
        print(str(int(Count)) + " BIRTHDAY MATCHES FOUND IN A GROUP OF 23!")
    else:
        losses += 1
        print("NO BIRTHDAY MATCHES FOUND!")

print("")
print(str(wins) + " WINS AND " + str(losses) + " LOSSES.")