Untitled
import random # Number of attempts num_attempts = 10 # Probability of success success_probability = 0.1 # Record the results results = [] for attempt in range(1, num_attempts + 1): if random.random() < success_probability: results.append((attempt, "Success")) else: results.append((attempt, "Failure")) print(results)
Leave a Comment