Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions other/guess_the_number_userplay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import random

Check failure on line 1 in other/guess_the_number_userplay.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

other/guess_the_number_userplay.py:1:1: I001 Import block is un-sorted or un-formatted

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 👇")

Check failure on line 11 in other/guess_the_number_userplay.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (RUF001)

other/guess_the_number_userplay.py:11:24: RUF001 String contains ambiguous `’` (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
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()

Check failure on line 34 in other/guess_the_number_userplay.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W292)

other/guess_the_number_userplay.py:34:8: W292 No newline at end of file
Loading