Practice2_Spring_2024

.docx

School

Columbia University *

*We aren’t endorsed by this school

Course

5210

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

4

Uploaded by DeaconHare3679

Report
Python for Data Analysis – Practice 2 1. Consider the list below: school_material_list = ['books', 'notebooks', 'pencils', 'pens', 'erasers'] What output is generated by the statement below? print(school_material_list[5]) a. [‘erasers’] b. erasers c. IndexError d. None of the above 2. Consider the list below: MyExpenses = [[10, 25, 60], [34, 95, 17], [18, 26, 48]] What is the outcome of the statement below? print(MyExpenses[2][2]) a. [34,95,17] b. (34,95,17) c. 95 d. None of the above 3. What will the code below print? my_list1 = [76, 77, 78, 79] my_list2 = [40, 41] my_list3 = my_list1 + my_list2 my_list3.append(99) print(my_list3) a. (76, 77, 78, 79, 99) b. [76, 77, 78, 79, 40, 41] c. [76, 77, 78, 79, 40, 41, 99] d. [76, 77, 78, 79, 99] e. none of the above 4. Consider the code below. Which is the output of the print statement? MyData = ([101.32, 97.34, 96.51], [1231, 2500, 3477], [.8,.95, .65]) print(MyData[2]) a. (1231, 2500, 3477) b. [.8, .95, .65] c. .95
d. None of the above 5. Given the tuple below, what is the output of the code below? T1 = ([2, 3, 5], [6, 10, 11], [9, 8, 7]) T1[1][1] = 13 print(T1[1]) a. 13 b. Type Error: tuple object does not support item assignment c. [6, 13, 11] d. none of the above 6. Consider the following list: lst=[‘a’,’b’,’c’,’d’,’e’,’f’] What will lst[1:3] give you? a. [‘a’,’b’,’c’] b. [‘a’,’b’] c. [‘b’,’c’] d. [‘b’,’c’,’d’] 7. Consider the following list: a = [77,78,79,80,81,82] What will a[1:6:2] give you? a. [77, 78, 79, 80, 81, 82] b. [78, 80, 82] c. [78, 79, 80, 81, 82] d. none of the above 8. What will be the output of the code below? str1 = ‘Applied Analytics’ print(str1[-9::2]) a. Aayis b. Analytics c. Apid d. none of the above
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help