ANS:


function colorGuess()
c= 'red';
guesses = 0;
stillPlaying = true;
while stillPlaying & guesses <3
  guess = input ('Guess my secret color: ','s');
  if strcmp(guess,c)
      disp('You guessed it!');
      stillPlaying = false;
  end
  guesses = guesses + 1;
end
if guesses == 3 & stillPlaying
    disp('Sorry, you lost!')
end