Untitled
Anonymous
plain_text
02/24/2026 5:07 PM
6.1 KB
10
Indexable
import random
import time
def play_game():
print("\n" * 2)
print("╔════════════════════════════════════╗")
print("║ Welcome to NUMBER CRUSHER 3000 ║")
print("╚════════════════════════════════════╝")
print("I'm thinking of a number between 1–100")
print("You get 8 guesses. Don't embarrass yourself.\n")
secret = random.randint(1, 100)
attempts_left = 8
guesses = []
while attempts_left > 0:
try:
guess = int(input(f"({attempts_left} guesses left) → Your guess: "))
except ValueError:
print("That's not even a number. Try again.\n")
continue
if guess in guesses:
print("You already guessed that one, genius.\n")
continue
guesses.append(guess)
if guess == secret:
print("\n┌─────────────────────────────┐")
print("│ YOU ACTUALLY DID IT?? │")
print(f"│ The number was {secret} │")
print("└─────────────────────────────┘")
return True
elif guess < secret:
print("Too low. Aim higher, coward.\n")
else:
print("Too high. Calm down, it's not a rocket.\n")
attempts_left -= 1
print("\nGame over. You losimport random
import time
def play_game():
print("\n" * 2)
print("╔════════════════════════════════════╗")
print("║ Welcome to NUMBER CRUSHER 3000 ║")
print("╚════════════════════════════════════╝")
print("I'm thinking of a number between 1–100")
print("You get 8 guesses. Don't embarrass yourself.\n")
secret = random.randint(1, 100)
attempts_left = 8
guesses = []
while attempts_left > 0:
try:
guess = int(input(f"({attempts_left} guesses left) → Your guess: "))
except ValueError:
print("That's not even a number. Try again.\n")
continue
if guess in guesses:
print("You already guessed that one, genius.\n")
continue
guesses.append(guess)
if guess == secret:
print("\n┌─────────────────────────────┐")
print("│ YOU ACTUALLY DID IT?? │")
print(f"│ The number was {secret} │")
print("└─────────────────────────────┘")
return True
elif guess < secret:
print("Too low. Aim higher, coward.\n")
else:
print("Too high. Calm down, it's not a rocket.\n")
attempts_left -= 1
print("\nGame over. You lose.")
print(f"The number was {secret}. Better luck next life.\n")
return False
# ────────────────────────────────────────
print("Want to play?")
while True:
choice = input("(y/n): ").lower().strip()
if choice in ("y", "yes", ""):
won = play_game()
if won:
print("You won... this time.")
again = input("\nPlay again? (y/n): ").lower().strip()
if again not in ("y", "yes", ""):
print("Coward. See ya.\n")
break
elif choice in ("n", "no"):
print("Wise choice. This game is brutal anyway.\n")
break
else:
print("Just say y or n my dude\n")
print(f"The number was {secret}. Better luck next life.\n")
return False
# ────────────────────────────────────────
print("Want to play?")
while True:
choice = input("(y/n): ").lower().strip()
if choice in ("y", "yes", ""):
won = play_game()
if won:
print("You won... this time.")
again = input("\nPlay again? (y/n): ").lower().strip()
if again not in ("y", "yes", ""):
print("Coward. See ya.\n")
break
elif choice in ("n", "no"):
print("Wise choice. This game is brutal anyway.\n")
break
else:
print("Just say y or n my dude\n")Editor is loading...
Leave a Comment