##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.23 - Alien Game.py
# Description: Alien Game
##############################################################################
import random
MAX_ATTEMPTS = 3
tree = random.randint(1, 100)
print("An alien is hiding behind a tree")
print("Each tree was numbered from 1 to 100.")
print("You have 3 attempts to guess on which tree")
print("the alien hides.")
print(tree)
for attempt in range(1, MAX_ATTEMPTS + 1):
guess = int(input(f"Tree {attempt}/{MAX_ATTEMPTS}: "))
if guess == tree:
print(f"You got it in the attempt #{attempt}")
break
elif guess > tree:
print("Too high")
else:
print("Too low")
else:
print("You couldn't get it right.")
print(f"The alien was in the tree {tree}")