I am trying to write a code. The code is below and the if loops that I wrote seems to allow some of the conditions to pass. How should I look at this situation. Thank you.
import numpy
import random
spinamount = 100
initialmoney=4950
betamount=5
spinresults = [0,"red","black"]
spindist = [0.027,0.486,0.486]
start = []
#spins = numpy.array(start)
spins = []
for spin in range(0,spinamount+1):
outcome = random.choices(spinresults,spindist)
spins.append(outcome)
##############################
for lastspin in range(11,spinamount):
if not any(v == 0 for v in spins[-10:]):
if spins[lastspin]==spins[lastspin-3] and spins[lastspin-1]==spins[lastspin-2]:
initialmoney=initialmoney-betamount
pattern = [spins[lastspin-4],spins[lastspin-5],spins[lastspin-6],spins[lastspin-7],spins[lastspin-8],spins[lastspin-9],spins[lastspin-10]]
print(pattern)
print()
When it prints, I want the pattern list to have no zeros in it however the printed include zeros... is my first if statement wrong? How should I write it? Thanks
Aucun commentaire:
Enregistrer un commentaire