Week 4 Warm Up

Write down (or type) the answer for each question. Demo them to me when you are done.

Given a string variable called myString write one line of code that would:

1) Print the first letter.

2) Print the string from the 2nd letter to the 5th letter.

3) Find the index of the first occurance of the letter "b".

4) Find the length of the string.

5) Print the part of the string from the first "b" until the end.

6) Print the part of the string from it's start until three letters before the first "b". (Example for "This is a basic test" print "This is")

7) Print the string with all the occurences of "b" replaced by "BBB".

Optional lab exercise: Write a program that checks if a string the user entered is a palandrome.

Optional lab exercise 2: Extend the above program to accept palandromes that contain arbitrary spacing and capitalization. Example "Never odd or even"