question # 6\nmultiple choice\nwhat is the missing line of code?\n>>> sentence = \programming is…

question # 6\nmultiple choice\nwhat is the missing line of code?\n>>> sentence = \programming is fun!\\n>>>\ngra\nsentence2:6\nsentence2:5\nsentence3:5\nsentence3:6

question # 6\nmultiple choice\nwhat is the missing line of code?\n>>> sentence = \programming is fun!\\n>>>\ngra\nsentence2:6\nsentence2:5\nsentence3:5\nsentence3:6

Answer

Brief Explanations:

In Python, string slicing string[start:stop] extracts characters from start (inclusive) to stop (exclusive). For the string "Programming is fun!", to get 'gra', the start index should be 3 (since indexing starts at 0, 'P' is 0, 'r' is 1, 'o' is 2, 'g' is 3) and the stop index should be 6 to include 'g', 'r', 'a' but not the next character.

Answer:

D. sentence[3:6]