python - List length in a while loop -


I am writing a program that compares coin to two players. I do not understand why the following while loop prints "Game over", even though the lanes of both lists are 5. When I type the lane (player_x_armi) or responds with the correct 5 then If I "or" from "and" This works fine "

  while len (player_1_army) or len (player_2_army) == 0: print (" game over ")  < 
 

lane (player_1_army) is not zero therefore, or is correct, thus while is looped.

In any Boolean expression, if any number is present, then its evaluation is number! =! 0 .

Instead, you'll need it:

  Lane (player_1_ army) == 0 or lane (player_2_ army) == 0  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -