Add to the code below winning $1 on "000", "007" combinations for i in range(trials): num = np.random.randint(1, 1000) if num == 777: money += 200; successes += 1 elif num == 999: money += 100; successes += 1 elif num == 555: money += 50; successes += 1 elif num == 333: money += 15; successes += 1 elif num == 111: money += 10; successes += 1 elif ends77(num) == True: money += 5; successes += 1 elif ends7(num) == True: money += 3; successes += 1 elif ends00(num) == True: money += 2; successes += 1 elif ends0(num) == True: money += 1; successes += 1 else: money -= 1
def add_777999_555333_11110_77_7_00_0(a): if a == 777: return 200 elif a == 999: return 100 elif a == 555: return 50 elif a == 333: return 15 elif a == 111: return 10 elif a%10 == 7 and a//10%10 == 7: return 5 elif a%10 == 7: return 3 elif a//10%10 == 0 and a//100%10 == 0: return 2 elif a//10%10 == 0: return 1 else: return 0 def find_score(num_trials): money = 0 successes = 0 for i in range(num_trials): money += add_777999_555333_11110_77_7_00_0(np.random.randint(1, 1000)) successes += 1 return money, successes