for i in range(repetitions): #random generator produces a num between 1 and 10. every time a num is produced the variable is incremented, diff is to calculate the difference between the expected freq and frequency of a certain number ie. 1
if numbers[i] == 1: one += 1 ; dif1 = one-freq
elif numbers[i] == 2: two += 1 ; dif2 = two-freq
elif numbers[i] == 3: three += 1; dif3 = three-freq
elif numbers[i] == 4: four += 1; dif4 = four-freq
elif numbers[i] == 5: five += 1; dif5 = five-freq
elif numbers[i] == 6: six += 1; dif6 = six-freq
elif numbers[i] == 7: seven += 1 ;dif7 = seven-freq
elif numbers[i] == 8: eight += 1 ;dif8 = eight-freq
elif numbers[i] == 9: nine += 1; dif9 = nine-freq
elif numbers[i] == 10: ten += 1; dif10 = ten-freq
Aucun commentaire:
Enregistrer un commentaire