QUESTION 3 Assume a grid can be referenced by rows and columns as shown below. For example, in the grid below Element (2, 1) refers to row 2 and column 1 (highlighted red). Rows Columns 1,1 2.1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 The command ColorGrid (row, column) colors the referenced cell. Note that in Python, range (starting, ending) command generates the sequence of integer numbers that begins with starting value and goes up to, but not including the, ending value. What does the following code do? def color_me(x): for i in range (1,4): ColorGrid(Xi) for j in range(3,4): color_meli) O Colors the third and fourth row of the grid. Colors only the third row of the grid. Colors only the third column of the grid. None of these choices QUESTION 4 Assume the list contains the scores of a recent basketball game season. What is the purpose of the following code? scores = [77, 82, 67, 42, 50) season = sum(scores)len(scores) print(season) Calculating the average of the scores O Printing out the scores O Calculating the sum of the scores O None of the above
Based on the following list, what would be the minimum value? fruits = ["Strawberry", "Apple", "Orange", "Kiwi", "Banana"] "Banana" "Kiwi "Orange" "Apple" QUESTION 6 Based on the following, what can you conclude? inventory = 11 while len(inventory)< 5: item = input("Enter an item:") inventory.append(item) print(inventory) Printing out a list called Inventory Adding 5 items to populate a list called Inventory Adding 6 items to populate a list called Inventory Adding 4 items to populate a list called Inventory
QUESTION 3 Assume a grid can be referenced by rows and columns as shown below. For example, in the grid below Element (2
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am