Ask Question
2 July, 16:25

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

+4
Answers (1)
  1. 2 July, 16:46
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers