-- Part 4 mini-project: Number Guessing Game -- finished version. -- -- Run with: lua projects/03-number-guess/finished.lua local target = math.random(1, 100) local attempts = 0 print("I am thinking of a number between 1 and 100.") local guess repeat attempts = attempts + 1 io.write("Guess: ") guess = tonumber(io.read()) if guess < target then print("Too low.") elseif guess > target then print("Too high.") else print("Correct! You got it in " .. attempts .. " attempts.") end until guess == target