Today we are going to look at strings, for loops and if-then statements. Play around with strings and figure out what the following commands do. Notice the difference between the uses of := (assignment) and = (testing if two things are equal). I used both

> with(StringTools); # load functions about strings

> A:="high";

> B:="five";

> C:=cat(A,B): C;

> A[3];

> B[2..3];

> C[-3];

> length(cat(B,A));

> searchtext("h",C);

> SearchAll("h",C);

> for n from 1 to length(A) do

print n,A[n];

od;

> out:="";

> for n from 1 to length(A) do

out:=cat(out,A[n],B[n]);

end do:

> out;

> out:="";

> for n from 1 to length(A) do

out:=cat(out,A[-n],B[n]);

end do:

> out;

> out:="";

> for n from 1 to length(C) do

if not IsVowel(C[n]) then

out:=cat(out,C[n]);

else

out:=cat(out,".");

fi;

od;

> out;

Given some string, finish with the letters of the string in reverse order. Example: if you were to start with the string

Given a string with spaces in it like

Given a string with spaces in it like

You should open up a new worksheet and start from scratch. You will have to save your work in a file and upload that file on to the course moodle. Your solution should be a sequence of commands where it is easy to change the input string and after you execute the sequence of commands you should have the correct output string. I don't need to see your experiments with the commands that I have above, but I am interested in how far you are able to get with the three questions above.