Ask Question
7 November, 23:04

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

+5
Answers (1)
  1. 7 November, 23:14
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers