Untitled
unknown
python
3 years ago
448 B
52
Indexable
import random simulations = 1000000 total_matches = 0 for i in range(simulations): chosen_seats = random.sample(range(1, 13), 3) # Picks 3 unique numbers between 1 and 12 seat1 = chosen_seats[0] seat2 = chosen_seats[1] seat3 = chosen_seats[2] if (abs(seat2 - seat1) % 10) == 1 or (abs(seat3 - seat2) % 10) == 1 or (abs(seat3 - seat1) % 10) == 1: total_matches += 1 total_matches /= simulations print(total_matches)
Editor is loading...