Using MATLAB. Please pay attention to the (Restrictions), because the assessment
ID: 3721808 • Letter: U
Question
Using MATLAB. Please pay attention to the (Restrictions), because the assessment will be incorrect!
Pangram:s A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Write a logical function called isPangram to determine if a sentence is a pangram. The input sentence is a string scalar of any length. The function should work with both upper and lower case Restrictions: The function should use the functions isspace, unique, and all at least once. Ex: >>The quick brown fox jumps over the lazy dogs"; answer-isPangram(s) answer logical >>The quick brown "answer-isPangram(s) answe r = logical Your Function 1 function tf isPangram(s) Save C Reset MATLAB Documentation % Your code goes here 4 5 end Code to call your function C Reset 1 s-"The quick brown fox jumps over the lazy dogs", answer=isPang ram (s) Run FunctionExplanation / Answer
function tf = isPangram(s)
s = unique(lower(s)) %convert to lower case and remove duplicates
%remove all spaces
if isspace(s)
s = strrep(s, ' ', '')
end
letters = 'a' : 'z'; % the letters a to z
%find the difference set between letters and the string s
diff = setdiff(letters, s);
tf = isempty(diff) || ~all(diff); %if the difference set is empty, it is pangram, not pangram if there are atleast few letters from a-z not present in s
end