import random array = [] games = 100000 wins = 0 for i in range(games): caphp = 1 thanoshp = 56 wins += 1 while thanoshp > 0: deflect = random.randint(1,2) if deflect == 1: caphp -= random.randint(1,20) if caphp < 1: wins -= 1 break else: thanoshp -= random.randint(1,20) array.append(max(thanoshp, 0)) print("Game", i+1) number = 0 for i in array: number += i number /= len(array) print("\n{} games played, {} won ({}%)\nAverage Thanos HP: {}".format(games, wins, round(wins/games * 100, 2), round(number, 2)))