Programming Homework Help. University of Maryland Global Campus Collection of Numeric Values Questions
Question 1 (10 points)
undefined
Which of the following is the correct output from the following program?
sequence = [1, 4, 7, 10, 13]
for i in range(len(sequence)):
if i > 2:
sequence[i] = sequence[i] – sequence[i-2]
print(sequence)
Question 2 (10 points)
undefined
Which of the following for loops will compute the sum of all the elements in the array numbers, assuming numbers has already been assigned a collection of numeric values?
Question 3 (10 points)
undefined
Which of the following is the correct output from the following sequence of statements?
sequence = [0, 1, 1, 2, 3, 5, 8]
sequence[-3] = 0
print(sequence[5])
Question 4 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
letters = [‘a’, ‘b’, [‘c’, ‘d’, [‘e’, ‘f’]], ‘g’]
print(len(letters[2]))
Question 5 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
digits = [‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’]
digits.remove(‘2’)
third = digits.pop(3)
print(digits)
Question 6 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
array1 = [1, 2, 3]
array2 = [2, 3]
print(array1 + array2 * 2)
Question 7 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
cubes = [1, 8, 27, 64, 125, 216]
cubes[3:5] = [1, 2]
print(cubes[2:6])
Question 8 (10 points)
undefined
Which of the following programs will output None?
Question 9 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
numbers = [18, 27, 42, 13, 21, 8, 11]
print(sum(numbers) / len(numbers))
Question 10 (10 points)
undefined
Which of the following is the correct output from this sequence of statements?
numbers = [1, 2, 3]
numbers.append(2)
numbers.sort()
print(numbers)