I am just starting to learn, this is actually my very first project, and I haven'e been able to figure out or find why the while loop does not end (under any outcome) and also why it fails to print the player scores (lines 23, 24, 32, 33, 40, 41).
I'd appreciate any help.
I'd appreciate any help.
# Creates random numbers import random #Sets start number at 0 player1_score = 0 player2_score = 0 #Repeats block until a player reaches best of 10 while player1_score or player2_score < 6: #Generate random number between 1 and 6 for each player player1_value = random.randint(1, 6) player2_value = random.randint(1, 6) #Show values print("Player 1 rolled: ", player1_value) print("Player 2 rolled: ", player2_value) #Selects winner of roll, increments and displays win totals, and ends game if winner is found if player1_value > player2_value: print("Player 1 wins!") player1_score = player1_score + 1 print("Player 1 score is: ", player1_score) print("Player 2 score is: ", player2_score) if player1_score > 5: print("### Game Over ###") print("### Player 1 is the winner! ###") break elif player2_value > player1_value: print("Player 2 wins!") player2_score = player2_score + 1 print("Player 1 score is: ", player1_score) print("Player 2 score is: ", player2_score) if player2_score > 5: print("### Game Over ###") print("### Player 2 is the winner! ###") break else: print("It's a draw!") print("Player 1 score is: ", player1_score) print("Player 2 score is: ", player2_score) if player1_score and player2_score == 5: print("The game has ended in a draw!") break #Continues if winner is not found input("Press enter to continue")