I am new to coding and this is the first proper program I have tried to code.
The first round works as I intended it to but the 2nd and 3rd rounds jump to the line "puts "Wrong!" puts "You have reached the maximum number of guesses. You get zero points for this round""
even if I correctly answer the questions. Any tips on how to fix this?
points = 0
puts "Welcome to my game. There are three rounds of questions in this quiz."
puts "You get a point for each question you get right within 3 guesses" 
puts "Please press enter to continue"
gets
puts "Round 1"
puts "I am thinking of a random number between 1 and 100. You have 3 attempts to guess my number correctly"
random_number = rand(1 .. 100)
guess = ""
guess_count = 0
out_of_guesses = false
while guess != random_number and !out_of_guesses
    if guess_count == 0
        puts "Enter your guess:"
        guess = gets.chomp.to_i
        guess_count += 1
      
    elsif guess_count == 1
      if random_number > 50
        puts "Wrong! Try again"
        puts "Hint 1:"
        puts "My number is bigger than 50"
      elsif random_number < 50
        puts "Wrong! Try again"
        puts "Hint 1:"
        puts "My number is smaller than 50"
      end
        puts "Enter your second guess:"
        guess = gets.chomp.to_i
        guess_count += 1
      
    elsif guess_count == 2
      if guess > random_number 
        diff1 = guess - random_number
        puts "Wrong! Try again"
        puts "Hint 2:"
        puts "My number is #{diff1} numbers away from your guess"
      elsif guess < random_number
        diff2 = random_number - guess
        puts "Wrong! Try again"
        puts "Hint 2:"
        puts "My number is #{diff2} numbers away from your guess"
      end
        puts "Enter your final guess:"
        guess = gets.chomp.to_i
        guess_count += 1
    else 
        out_of_guesses = true
    end
end
if out_of_guesses
    puts "Wrong!"
    puts "You have reached the maximum number of guesses. You get zero points for this round."
    puts "The number I was thinking about was #{random_number}"
else
    points += 1
    puts "Congratulations! You get a point!"
    puts "You correctly guessed that the number I was thinking about is #{random_number} and you did it in #{guess_count} guesses."
end
puts "Press enter to continue"
gets
def answer_my_question(question, right_answer)
answer = ""
out_of_guesses = false
guess_count = 0
guess_limit = 3
puts "You get 3 tries to answer this question and there are no hints in this section"
puts question
while answer != right_answer and !out_of_guesses
  if guess_count == 0
    puts "Enter your first guess"
    answer = gets.chomp.downcase
    guess_count += 1
  elsif guess_count < guess_limit
    puts "Wrong! Try again"
    answer = gets.chomp
    guess_count += 1
  else
    out_of_guesses = true
end
end
end
puts "Round 2"
answer_my_question("What is the capital of Spain?", "madrid")
if out_of_guesses
    puts "Wrong!"
    puts "You have reached the maximum number of guesses. You get zero points for this round"
else
    points += 1
    puts "Congratulations! You get a point!"
    puts "You correctly answered the question."
end
puts "Press enter to continue"
gets
puts "Round 3"
answer_my_question("What continent is jamaica in?", "north america")
if out_of_guesses
    puts "Wrong!"
    puts "You have reached the maximum number of guesses. You get zero points for this round"
else
    points += 1
    puts "Congratulations! You get a point!"
    puts "You correctly answered the question."
end
puts "Press enter to continue"
gets
puts "This is the end of the quiz. You ended up with #{points} points"
I put the downcase method in to try and mitigate any case-sensitivity issues but it is not working
 
    