i made code to randomly generate weighted numbers and whenever i tell it to break when it generates a certain number it doesnt do it code:
import random
while True:
numberList = [0, 100, 250, 500, 1000, 2000, 5000, 10000, 25000, 50000, 75000, 100000, 250000, 500000, 750000, 1000000, 5000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000]
tapped = (random.choices(numberList, weights=(1, 1/25, 1/250, 1/500, 1/1000, 1/2000, 1/5000, 1/10000, 1/25000, 1/50000, 1/75000, 1/100000, 1/250000, 1/500000, 1/750000, 1/1000000, 1/5000000, 1/10000000, 1/100000000, 1/1000000000, 1/10000000000, 1/100000000000, 1/1000000000000, 1/10000000000000, 1/100000000000000, 1/1000000000000000), k=100))
print(tapped)
if tapped == 500:
break
i tried adding a while true command, i tried using
if tapped = 500:
print('you got a 500')
and also
if tapped = 1/500
print('you got a 500')
and both dont work (1 being from the list and the other from the weights) so im not sure what else to try
Aucun commentaire:
Enregistrer un commentaire