Comparing two arrays: answers vs. answer key

I’m trying to create a simple quiz, get user answer input and then
compare the users answers to the correct answers and then display the
percentage correct (or the “grade”).

My puts statement at the very bottom was for me to verify the users
answers were being added to the user answer array.

Thanks for any help!

my code is attached as a file. sorry for the inconvenience

You’ll want something like this:

if answer == question[:answer]
puts “correct”
else
puts “wrong”
end

Or maybe this:

puts ( answer == question[:answer] ? ‘correct’ : ‘wrong’ )

The first suggestion works perfectly! Thank you!