Show Answer

 

The correct answer is C.

OBJ-4.4: When evaluating the code s[4::-1], you would receive “TnoiD” in response. Within Python, characters in a string can be accessed by their index location. If the string (s) is “DionTraining.com”, then each letter from left to right is referenced as s[0] to s[15]. For example, if you enter s[5], you would receive the letter “r” in response. The format for the array is [start:end:increment], so s[4::-1] is evaluated as starting with the 4th position (T in DionTraining.com since computers start counting at 0), count until it reaches the beginning or end of the word, and then increment by one position each time to the left (since it was -1). This would display the 4th position (T), 3rd position (n), 2nd position (o), 1st position (i), the zero position (D), and then stop.

Hide Answer