Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3.3 1) Which of the following are true for a string that\'s 10 characters

ID: 640270 • Letter: P

Question

Python 3.3

1) Which of the following are true for a string that's 10 characters long? Select all that apply.

a) The first character is indexed -10.

b) The last character is indexed 9.

c) The last character is indexed 10.

d) The first character is indexed -9.

e) The first character is indexed 1.

f) The first character is indexed 0.

========================================================================================================

2)

Which of the following are correct? Select all that apply.

a) The find() method returns -1 to indicate a failed search.

b) The find() method returns the location of a substring, counting the first character in the string as #1.

c) The index() method causes an error if the substring is not present.

d) The find() method returns the starting index of the first occurence of the substring at or after the starting point (assuming it's present).

e) Both index() and find() can take an optional parameter to start searching somewhere other than the beginning of the string.

f) Calling find() if a substring is present multiple places in the string is a logic error.


a) The first character is indexed -10.

b) The last character is indexed 9.

c) The last character is indexed 10.

d) The first character is indexed -9.

e) The first character is indexed 1.

f) The first character is indexed 0.

========================================================================================================

2)

Which of the following are correct? Select all that apply.

a) The find() method returns -1 to indicate a failed search.

b) The find() method returns the location of a substring, counting the first character in the string as #1.

c) The index() method causes an error if the substring is not present.

d) The find() method returns the starting index of the first occurence of the substring at or after the starting point (assuming it's present).

e) Both index() and find() can take an optional parameter to start searching somewhere other than the beginning of the string.

f) Calling find() if a substring is present multiple places in the string is a logic error.


Explanation / Answer

1) a, b, f

2) a, c, d, e