RuthvikSaiKumar / 100-Prisoners-Riddle

This is the program written to prove the 100 Prisoners Riddle made by Veritasium.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

100-Prisoners-Riddle

This is the program written to prove the 100 Prisoners Riddle made by Veritasium.

First it calculates the probability of the prisoners winning on hundred attampts (to calculate the percentage),
then, I repeated it for 1000 times to calculate the average percentage of winning.

Output:

| ████████████████████████████████████████████████████████████████████████████████████████████████████  | 100 % done
Average number of times prisoners are freed: 30.026%

The value comes close to what was expected by Veritasium.

You can repeat the calculation any number of times to calculate precise average (by changing the times variable).
You can also change the number of prisoners.

Thank you for reading! Have a good day 😄

About

This is the program written to prove the 100 Prisoners Riddle made by Veritasium.

License:MIT License


Languages

Language:Python 100.0%