From 7b8c977a4fccca812805d288eaa94979f48a005f Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Mon, 21 Jan 2019 06:20:29 +0530 Subject: [PATCH] Fix logic condition This fixes the logic because else the number of sticks could go in negative and this won't stop. --- docs/looping.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/looping.rst b/docs/looping.rst index 6be051f..8962241 100644 --- a/docs/looping.rst +++ b/docs/looping.rst @@ -458,7 +458,7 @@ This is a very simple game of sticks. There are 21 sticks, first the user picks while True: print("Sticks left: " , sticks) sticks_taken = int(input("Take sticks(1-4):")) - if sticks == 1: + if sticks <= 1: print("You took the last stick, you lose") break if sticks_taken >= 5 or sticks_taken <= 0: