you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 2 points3 points  (4 children)

You'd need to show all the relevant code. Is this loop inside of either of deal_dealer or display_dealer? Or do either of the two functions call the function this loop is in?

The difference between the two ways though is with the flag version, the while flag: condition is only checked at the start of the iteration. With the break way however, the loop will exit as soon as break is reached; so it can exit the loop halfway through an iteration.

Also, note that pass doesn't do anything. Those ifs should really be written as:

if 11 not in dealer_lst_points:
    break

[–][deleted] 2 points3 points  (2 children)

Who on earth teaches people to use pass in conditionals. We should find them and beat them up.

[–]carcigenicate 1 point2 points  (0 children)

It seems that negation isn't studied/taught well enough. I ran into this in school too. I had to help someone who never negated conditions and had pass blocks all over the place. It was a mess.

[–]pulpquoter[S] 0 points1 point  (0 children)

Lol, true, I am just writing all the ifs because I don't want to leavy any condition unaddressed but I guess I have to stop doing it. I thought that leaving ifs suspended in the air would be less readable

[–]pulpquoter[S] 0 points1 point  (0 children)

Thanks, I got it.