Number once decrease

Hi, i am newbie, but have some experience, i am making some study expamples for me, i making money decreasing or increase when is the other number selected i already made number with random range when i press A the number change (0,10) and i make a money and when is the number one selected money decrease by hundred, but the hundred decrease per second of my money and i want make this when i press A the money will be decrease by hundred 1000-100=900 how can i make it ?
there is the code:

var number : int;
    var money: float;
     
     function Start() {
     number = Random.Range(1,10);
     money = 1000;
     }
     
     
     function Update() {
     if (Input.GetKeyDown(KeyCode.A)){
     number = Random.Range(1,10);
     }
    if (number == 1){
     money -= 100;
     }
     
     }
     
     function OnGUI() {
     GUI.Label(Rect(10,50,100,300), "Money: " + money);
     GUI.Label(Rect(10,10,100,300), "The number that was generated: " + number);
     if(number >=5){
     GUI.Label(Rect(180,10,100,300), "Bad");
     } else {
     GUI.Label(Rect(180,10,100,300), "Nice");
     }
     }

So you only want to subtract money (with 1 in 9 chance) in the frame in which they was pressed? Try:

function Update() {
  if (Input.GetKeyDown(KeyCode.A)){
    number = Random.Range(1,10);
    if (number == 1){
      money -= 100;
    }
  }
}