This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def guess_number(): | |
number_to_guess = random.randint(1, 100) | |
attempts = 0 | |
print("Welcome to Guess the Number! I am thinking of a number between 1 and 100.") | |
while True: | |
try: | |
guess = int(input("Enter your guess: ")) | |
attempts += 1 |