!true = false
!false = true
if (10 != 20) means if 10 is not equal to 20
if (!(10 == 20) means if NOT 10 is equal to 20
State the events that happens in the whole process when asking for user input.
Ie, ask for input, if guessed > real ...
This isn't difficult. Then you can easily translate that logic into code.
Give it a try and reply if you have problems.