I have this code:
Roll=[1,2,4]
for h in Roll:
if set(Roll)=={4,5,6}:
print('Automatic win! Banker wins all bets! Round ends!')
break
elif len(set(Roll))==2 and Roll.count(h)==2:
Roll.remove(h)
Roll.remove(h)
if Roll[0]==1:
print('Banker lost')
elif Roll[0]==2:
banker_score=Roll[0]
print('Banker scored ',banker_score)
elif Roll[0]==3:
banker_score=Roll[0]
print('Banker scored ',banker_score)
elif Roll[0]==4:
banker_score=Roll[0]
print('Banker scored ',banker_score)
elif Roll[0]==5:
banker_score=Roll[0]
print('Banker scored ',banker_score)
elif Roll[0]==6:
print('Automatic win! Banker wins all bets! Round ends!')
elif set(Roll)=={1,2,3}:
print('Banker lost')
break
elif Roll[0]==Roll[1]==Roll[2]:
print('Automatic win! Banker wins all bets! Round ends!')
break
*This code is part of a bigger code so the list elements(here they are stable),change because i want to check if my code works.Till this point my code works fine but i have 1 problem.If the combination of the list elements isnt in one of the if,elif the code should re-run the whole process printing Banker rolls again.My question is: will a while true loop help me here?
question from:
https://stackoverflow.com/questions/65599234/python-while-true-loops 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…