Solution
num_words = 6;
num_sentences = 10;
long_paragraph = num_words * num_sentences;
Solution 1
num_words
num_sentences
% Because no semicolon was placed at the end of variable name, Matlab displays the value of that variable.
Solution 2
disp(num_words);
disp(num_sentences);
% disp is a built-in function and is a short version of the word display. This function is used to show variable values on the screen.
% When you write a long code, it is a good practice to use disp function to print out results because you can later easily search and find in your code lines where you display final or intermediate results. Of course you will type a bit more, but it will save you time in longer run.
Solution
probability_1 = 0.1;
probability_2 = 0.01;
odds = probability_1 / probability_2;
disp(odds);
%
Solution
who;
% You will get back list of all variables. There should be if you completed all assignments so far.
% However, if you completed it your own way, you may get different result. Here is what I got:
% long_paragraph num_sentences num_words odds probability_1
% probability_2 simple_text visual_intensity
Solution
clear probability_1;
who;
% probability_1 is now missing from the list of in-memory variable.
% You may notice that function clear
% You will get back list of all variables. There should be if you completed all assignments so far.
% However, if you completed it your own way, you may get different result. Here is what I got:
% long_paragraph num_sentences num_words odds probability_1
% probability_2 simple_text visual_intensity
Solution
clear all
who
% The command will return empty result because we just deleted all variables.
% You may want to do this to clear up memory, but be careful that you can recompute everything
% and ensure that you wouldn't lose the results permanently.