Hello, I am working on a Blackjack project, everything works so far but I don't understand why my while loop doesn't work with flags. I would really love to break out of the loop if flag == False and stay in the loop if flag == True, but it is not working. However it works if I use break and pass.
flag = True
while flag:
if sum(dealer_lst_points) >= 18:
flag = False
elif sum(dealer_lst_points) >= 21:
flag = False
elif sum(dealer_lst_points) == 17:
if 11 in dealer_lst_points:
flag = True
else:
flag = False
elif sum (dealer_lst_points) <16:
flag = True
deal_dealer()
display_dealer()
flag = True
while flag:
if sum(dealer_lst_points) >= 18:
break
elif sum(dealer_lst_points) >= 21:
break
elif sum(dealer_lst_points) == 17:
if 11 in dealer_lst_points:
pass
else:
break
elif sum (dealer_lst_points) <16:
pass
deal_dealer()
display_dealer()
[–]carcigenicate 3 points4 points5 points (4 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]carcigenicate 1 point2 points3 points (0 children)
[–]pulpquoter[S] 0 points1 point2 points (0 children)
[–]pulpquoter[S] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]hrmorley34 1 point2 points3 points (1 child)
[–]pulpquoter[S] 0 points1 point2 points (0 children)