Pressing a button during a time limit

Hello! First of all, I’m new to programming in general, so this question may actually be pretty stupid.

How can I make so I have a set time limit(4 seconds, in this case) to press a button to activate a led, but still count the rest of the time after I press the button?

To make it clearer, here’s what I want to do:

1-Program starts, Led1 turns on;
2-Count 4 seconds, if the button is pressed during this time then Led2 turns on, the program continues to count the rest of the time and Led1 turns off;
3-If the button wasn’t pressed during the 4 seconds, then Led1 turns off;

Here’s the part of the code I’m having trouble with:

int cont;
int Nmin=DigitalRead(bt1);

digitalWrite(led1, HIGH)

for(cont = 0; cont < 8; cont++){

if (Nmin==HIGH){
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);

Problem is, when I press bt1 during the 4 seconds it won’t turn Led2 on. If I keep it pressed it will only activate led2 after the program loops. I tried using while() and for() but I got the same results. What am I doing wrong?

To learn how to be able to multi-task look at the Examples —> 02. Digital —> BlinkWithoutDelay sketch.