我正在尝试创建一个随机数学方程式(只需简单的加法),其中给您两个随机数,您需要将它们相加。我的问题是用于答案的两个随机数与方程式中使用的随机数不同
puts "Choose the number range (difficulty of the equation)"
difficulty = gets.chomp
a = rand(difficulty)
b = rand(difficulty)
answer = a + b
puts "#{a} + #{b}"
UserAnswer = gets.chomp
if UserAnswer == answer
puts "good"
else
puts "bad"
end