
Q:

1. What are escape characters?
An escape character lets you use characters that are otherwise impossible to put into a string.

Q:

2. What do the \n and \t escape characters represent?
newline and tab

Q:

3. How can you put a \ backslash character in a string?
double slash \\

Q:

4. The string value "Howl's Moving Castle" is a valid string. Why isn’t it a problem that the single quote character in the word Howl's isn’t escaped?
Double quotes alllow single quotes inside.

Q:

5. If you don’t want to put \n in your string, how can you write a string with newlines in it?
you can use multiline stirngs '''
 see '''

Q:

6. What do the following expressions evaluate to?

'Hello world!'[1]
e
'Hello world!'[0:5]
Hello
'Hello world!'[:5]
Hello
'Hello world!'[3:]
lo world!

Q:

7. What do the following expressions evaluate to?

'Hello'.upper()
HELLO
'Hello'.upper().isupper()
True
'Hello'.upper().lower()
hello
Q:

8. What do the following expressions evaluate to?

'Remember, remember, the fifth of November.'.split()
 ['Remember,', 'remember,', 'the', 'fifth', 'of', 'November.']

'-'.join('There can be only one.'.split())
'There-can-be-only-one.'

Q:

9. What string methods can you use to right-justify, left-justify, and center a string?

Q:

10. How can you trim whitespace characters from the beginning or end of a string?