{}

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →
run-icon
main.py
import random # Define the double streets double_streets = { 1: list(range(1, 7)), # [1, 2, 3, 4, 5, 6] 2: list(range(7, 13)), # [7, 8, 9, 10, 11, 12] 3: list(range(13, 19)), # [13, 14, 15, 16, 17, 18] 4: list(range(19, 25)), # [19, 20, 21, 22, 23, 24] 5: list(range(25, 31)), # [25, 26, 27, 28, 29, 30] 6: list(range(31, 37)), # [31, 32, 33, 34, 35, 36] } # Function to find the double street for a given number, ignoring 0 def find_double_street(num): if num == 0: return None for street_num, street in double_streets.items(): if num in street: return street_num return None # Track the number of double streets results results = [] zero_count = 0 # Simulate the rounds for round_num in range(1000): count_double_streets = 0 selected_numbers = random.sample(range(0, 37), 6) # Choose 6 unique numbers from 0 to 36 zero_count += selected_numbers.count(0) # Count how many times 0 appears hit_streets = set() # Track which double streets were hit hit_street_numbers = [find_double_street(num) for num in selected_numbers] # Store the double street numbers for each hit valid_hits = [num for num in hit_street_numbers if num is not None] # Remove None values for 0 in calculations hit_streets.update(valid_hits) # Add street numbers to the set count_double_streets = len(hit_streets) results.append(count_double_streets) # Calculate statistics, excluding 0 double streets total_rounds = len(results) counts = {i: results.count(i) for i in range(1, 7)} # Count occurrences for 1 to 6 percentages = {i: (counts[i] / total_rounds) * 100 for i in range(1, 7)} # Calculate percentage for 1 to 6 # Calculate the percentage for 4 or more and 3 or less four_or_more = sum(results.count(i) for i in range(4, 7)) # Count occurrences for 4, 5, 6 three_or_less = sum(results.count(i) for i in range(1, 4)) # Count occurrences for 1, 2, 3 percentage_four_or_more = (four_or_more / total_rounds) * 100 percentage_three_or_less = (three_or_less / total_rounds) * 100 # Calculate zero percentage zero_percentage = (zero_count / (total_rounds * 6)) * 100 # Print counts and percentages for i in range(1, 7): print(f"Number of rounds with {i} double streets: {counts[i]} - Percentage: {percentages[i]:.2f}%") # Print additional percentages print(f"Percentage of rounds with 4 or more double streets: {percentage_four_or_more:.2f}%") print(f"Percentage of rounds with 3 or less double streets: {percentage_three_or_less:.2f}%") # Print zero count and percentage print(f"Percentage of rounds with zero appeared: {zero_percentage:.2f}%")
Output