import random
attempts = 0 #all code made by Joel or ThatOneDev.studio
invalidAttempts = 0
print("We are playing number guesser")
upTo = int(input("Pick a number to guess up to: "))
RN = random.randint(1,upTo)
while True:
guess = int(input("Guess your first number, "))
attempts += 1
if guess > RN and guess < upTo:
print("Too high, try again")
elif guess < RN and guess > 0:
print("Too low, try again")
elif guess > upTo or guess < 1:
print("Please enter a valid guess")
invalidAttempts += 1
elif guess == RN:
print(f"You guessed the number {RN} out of {upTo} numbers with {attempts} attempts and {invalidAttempts} invalid attempts")
break