Question 4
John wrote a 3-digit number on a piece of paper and asked Peter to guess it. Peter asked: “Is the number 723?” John replied: “One of the digits is correct. The position of that digit is also correct.” Peter asked again: “Is the number 745?” John replied: “One of the digits is correct. The position of that digit is wrong.” Peter asked again: “Is the number 842?” John said: “One of the digits is correct. The position of that digit is also correct.” Given that all the digits in that 3-digit number are all different, what is the number written by John?

