intlist[i:45largest = intlist[i]pos = ireturn (largest, pos)8Select one of the following to correct a line of code in the function.a. Line 2 should be: largest = -1b. Line 2 should be:...


17. The following function takes a parameter that is a list of integers; the list has at least one element. It is supposed to<br>find the integer that is the largest and find the position of that integer in the list. The function has two incorrect lines<br>of code that make the function compute the results incorrectly. Several lines are highlighted (bold, underlined) which<br>COULD be incorrect. In the following questions, choose the correct line of code that should be in the function.<br>1<br>def findlarge(intlist):<br>2<br>largest = 0<br>3<br>pos = 0<br>for i in range(1,len(intlist)):<br>if largest > intlist[i:<br>4<br>5<br>largest = intlist[i]<br>pos = i<br>return (largest, pos)<br>8<br>Select one of the following to correct a line of code in the function.<br>a. Line 2 should be: largest = -1<br>b. Line 2 should be: largest = intlist[0]<br>c. Line 4 should be: for i in range(0,len(intlist):<br>%3D<br>d. Line 4 should be: for i in range(1,len(intlist)-1):<br>e. Line 8 should be: return largest<br>18. Select one of the following to correct a line of code in the function.<br>a) Line 4 should be: for i in range(0,len(intlist):<br>b) Line 4 should be: for i in range(1,len(intlist)-1):<br>c) Line 5 should be: if intlist[i] > largest:<br>d) Line 5 should be: if largest >= intlist[i]:<br>e) Line 8 should be: return largest<br>67 00<br>

Extracted text: 17. The following function takes a parameter that is a list of integers; the list has at least one element. It is supposed to find the integer that is the largest and find the position of that integer in the list. The function has two incorrect lines of code that make the function compute the results incorrectly. Several lines are highlighted (bold, underlined) which COULD be incorrect. In the following questions, choose the correct line of code that should be in the function. 1 def findlarge(intlist): 2 largest = 0 3 pos = 0 for i in range(1,len(intlist)): if largest > intlist[i: 4 5 largest = intlist[i] pos = i return (largest, pos) 8 Select one of the following to correct a line of code in the function. a. Line 2 should be: largest = -1 b. Line 2 should be: largest = intlist[0] c. Line 4 should be: for i in range(0,len(intlist): %3D d. Line 4 should be: for i in range(1,len(intlist)-1): e. Line 8 should be: return largest 18. Select one of the following to correct a line of code in the function. a) Line 4 should be: for i in range(0,len(intlist): b) Line 4 should be: for i in range(1,len(intlist)-1): c) Line 5 should be: if intlist[i] > largest: d) Line 5 should be: if largest >= intlist[i]: e) Line 8 should be: return largest 67 00
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here