#### Arman777

Gold Member

- 1,476

- 102

A and B decide to duel but, being poor, they have just one gun (a six-shot revolver) and only one bullet. Being dumb, as well, this does not deter them and they agree to "duel" as follows: They will insert the lone bullet into the gun's cylinder, A will then spin the cylinder and shoot at B (who, standing inches away, is impossible to miss). If the gun doesn't fire then A will give the gun to B, who will spin the cylinder and then shoot at A. This back-and-forth duel will continue until one fool shoots the other. What is the probability that A will win?

Python:

```
import random
a_wins = 0
for i in range(10**6):
Chances = ["d","nd","nd","nd","nd","nd"] #nd = not dead, d = dead
while len(Chances)> 0:
b = random.choice (Chances) #A shoots B
if b == "d":
a_wins += 1
break
else:
Chances.remove("nd")
a = random.choice(Chances) #B shoots A
if a == "d":
break #A cannot win
else:
Chances.remove("nd") #wasting antoher chance
print(a_wins/10**6)
```