Made an epic showcase website and API!

This commit is contained in:
rzmk 2021-08-17 16:39:42 -04:00
parent 9e21e4dbdd
commit 1907fad7c5
89 changed files with 36444 additions and 3 deletions

28
projects/Day 12/main.py Normal file
View file

@ -0,0 +1,28 @@
from random import randint
from art import logo
print(logo)
print("Welcome to the Number Guessing Game!")
print("I'm thinking of a number between 1 and 100.")
actual_answer = randint(1, 100)
difficulty = input("Choose a difficulty. Type 'easy' or 'hard': ")
if difficulty == "easy":
guesses = 10
elif difficulty == "hard":
guesses = 5
while guesses > 0:
print(f"You have {guesses} attempts remaining to guess the number.")
answer = input("Make a guess: ")
if int(answer) < actual_answer:
print("Too low.\nGuess again.")
elif int(answer) > actual_answer:
print("Too high.\nGuess again.")
elif int(answer) == actual_answer:
break
guesses -= 1
if int(answer) == actual_answer:
print(f"You got it! The answer was {actual_answer}.")
else:
print("You've run out of guesses. You lose.")