Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 (10 points) Which of the following is the correct output from this sequence of statements? letters = ['a', 'b', ['c , d', ['e',

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Question 4 (10 points) Which of the following is the correct output from this sequence of statements? letters = ['a', 'b', ['c , d', ['e', 'f']], '9'] print (len (letters [ 2] ) ) 1 6 3 4 Question 5 (10 points) Which of the following is the correct output from the following sequence of statements? halves = [2 .0, 1. 0, 0.5, .25, .125] halves [-5] = 0 print (halves [1]) 2.0Question 8 (10 points) Which of the following is the correct output from this sequence of statements? arrayl = [1, 2, 3] array2 = [2, 3] print ( (arrayl + array2) * 2) [1 , 2, 3, 2, 3, 2, 3] O [ 1 , 2, 3, 2, 3] O [ 1, 2, 3] O [1, 2, 3, 2, 3, 1, 2, 3, 2, 3] Question 9 (10 points) 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 10 (10 points) 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? O sum = 0 for i in range (len (numbers) ) : sum - sum + i sum = 0 for i in range (len (numbers) ) : sum - sum + numbers [i] O sum = 0 for i in range (numbers) : sum = numbers [i] O sum = 0 for i in range (len (numbers) ) : sum = numbers [i]Question 6 (10 points) Which of the following programs will output [ 'X' , 'Y' , 'x' , 'y' ]? Oletters = ['x' , 'y'l letters . append ( [ 'X' , 'Y' ]) B letters . sort ( ) print (letters) Oletters = ['x' , 'y'l letters . append ( 'X ' , 'Y') letters . sort ( ) print (letters) Oletters = ['x', 'y'l letters . extend ( ['X' , 'Y'l) letters . sort () print (letters) Oletters = ['x' , 'y'] letters . extend ( 'X' , 'Y' ) letters . sort () print (letters) Question 7 (10 poQuestion 9 (10 points) 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) ['1' , '2', '5', '6' O 1'2' , '4', '5', '6' Ol'1', '3', '4', '6' Ol'1', 12', 14', '6' Question 10 (10 points) 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 7 (10 points) Which of the following is the correct output from this sequence of statements? numbers = [1, 2, 3, 4, 5 numbers [ 2 : 4] = [4, 3] print (numbers [1 : 3]) O [ 2 , 3] O [ 2, 4] O [ 2 , 4 , 3] O [ 2, 3 , 4 ] Question 8 (10 points) Which of the following is the correct output from this sequence of statements? arrayl = [1, 2, 3] array2 = [2, 3]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions