```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 ``` ```math.randomseed(os.time()) guessMe = math.random(100) print("C> Welcome to Guess The Number!") print("C> I've chosen a number for you to guess between 1 and 100. Go ahead and try your best. If you get frustrated, just type 'exit' to end the game.") io.write("U> ") guessAnswer = io.read() function isnum(n) if tonumber(n) ~= nil then return true else return false end end totalGuesses = 0 repeat if isnum(guessAnswer) then if tonumber(guessAnswer) == guessMe then print("C> Correct! It was " .. guessMe .. ". It took you " .. totalGuesses .. " time(s) to guess the correct number.") os.exit() elseif tonumber(guessAnswer) > guessMe then totalGuesses = totalGuesses + 1 print("C> You're too high! You've guessed " .. totalGuesses .. " time(s).") elseif tonumber(guessAnswer) < guessMe then totalGuesses = totalGuesses + 1 print("C> You're too low! You've guessed " .. totalGuesses .. " time(s).") end elseif guessAnswer == "exit" then print("C> You didn't guess the number, but you tried " .. totalGuesses .. " time(s). Better luck next time!") os.exit() else print("C> Please guess using numbers 1 through 100.") end io.write("U> ") guessAnswer = io.read() until guessAnswer == guessMe ```