Ask Question
7 March, 12:12

Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTimes[5] = {800, 775, 790, 805, 808}, print: 800 775 790

+2
Answers (1)
  1. 7 March, 15:33
    0
    runTimes = [800, 775, 790, 805, 808]

    x = runTimes[0:3]

    print (x)

    Explanation:

    The code is written in python. The question asked us to print the first elements of an array or list. The first three statement of a list can be printed by using the index of the list.

    runTimes = [800, 775, 790, 805, 808]

    This is the list or array containing elements. The variable runTimes is used to store the array or list.

    x = runTimes[0:3]

    The variable x is used to store the code, runTimes[0:3]. The code means the first three elements of the array or list. From index 0 to 3.

    print (x)

    The print function is now used to display the first three elements of the array.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTimes[5] = ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers