Как Робин Зигмонд ответил : вы воссоздаете случайное число, поэтому ни одно из условий не может соответствовать.
Fix:
while i < 100:
random_number = random.randint(min,max)
if random_number == 1:
print ("The die landed on 1.")
counter_1 +=1
result.append(1)
elif random_number == 2:
print ("The die landed on 2.")
counter_2 +=1
result.append(2)
elif random_number == 3:
print ("The die landed on 3.")
counter_3 +=1
result.append(3)
elif random_number == 4:
print ("The die landed on 4.")
counter_4 +=1
result.append(4)
elif random_number == 5:
print ("The die landed on 5.")
counter_5 +=1
result.append(5)
elif random_number == 6: # else: would suffice
print ("The die landed on 6.")
counter_6 +=1
result.append(6)
i +=1
Ваш симулятор смерти слишком сложен. random может генерировать список из 100 бросков кубиков одновременно. Вы можете использовать класс Counter для их легкого подсчета:
import random
min_value = 1 # min and max are already taken as names by built ins
max_value = 6
# create 100 random numbers 1 to 6 - range upper bound is exlusive, hence max_value+1
dices = random.choices(range(min_value,max_value+1), k= 100)
from collections import Counter
# create a dict that counts what dices happened how often
numbers = Counter(dices)
for die, count in sorted(numbers.most_common()):
print(f"Die {die} occured {count} times.")
print ("In a total of", 100, "number of simulations, The die landed on 1",
numbers[1], "times, landed on 2", numbers[2], "times, landed on 3",
numbers[3],"times, landed on 4" , numbers[4], "times, landed on 5",
numbers[5], "times, landed on 6", numbers[6], "times.")
Выход:
Die 1 occured 13 times.
Die 2 occured 18 times.
Die 3 occured 15 times.
Die 4 occured 17 times.
Die 5 occured 20 times.
Die 6 occured 17 times.
In a total of 100 number of simulations, The die landed on 1 13 times,
landed on 2 18 times, landed on 3 15 times, landed on 4 17 times,
landed on 5 20 times, landed on 6 17 times.
Readup: