From 3858b9f63c14ee8ad7619e990e5e5536e9482b2d Mon Sep 17 00:00:00 2001 From: CheerathAniketh Date: Tue, 18 Nov 2025 06:49:23 +0530 Subject: [PATCH 1/2] Add userplay Guess the number game --- other/guess_the_number_userplay.py | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 other/guess_the_number_userplay.py diff --git a/other/guess_the_number_userplay.py b/other/guess_the_number_userplay.py new file mode 100644 index 000000000000..49e1c7274d94 --- /dev/null +++ b/other/guess_the_number_userplay.py @@ -0,0 +1,34 @@ +import random + +def guess(): + print("🎯 Welcome to Guess the Number game!") + print("Rules are simple, guess a number between 0 and 20, and enter it below.") + print("Only 5 Attempts are possible") + print() + + + computer = random.choice(range(21)) + print("Alright, let’s go! Type your first guess πŸ‘‡") + print() + + print(computer) + + count = 0 + while True: + user = int(input("Number: ")) + if count == 5: + print("Try again, max only 5 Attempts") + break + if user == computer: + print("πŸ”₯ Success! You've guessed it right!") + break + elif user < computer: + print("Try some higher numbers!") + count += 1 + elif user > computer: + print("Not that high, try lower ones!") + count += 1 + + + +guess() From f3c57c218f7fa4e9e634cbcd0db3850d90661981 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 01:20:55 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- other/guess_the_number_userplay.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/other/guess_the_number_userplay.py b/other/guess_the_number_userplay.py index 49e1c7274d94..3085c4046074 100644 --- a/other/guess_the_number_userplay.py +++ b/other/guess_the_number_userplay.py @@ -1,12 +1,12 @@ import random + def guess(): print("🎯 Welcome to Guess the Number game!") print("Rules are simple, guess a number between 0 and 20, and enter it below.") print("Only 5 Attempts are possible") print() - computer = random.choice(range(21)) print("Alright, let’s go! Type your first guess πŸ‘‡") print() @@ -30,5 +30,4 @@ def guess(): count += 1 - guess()