
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![Assume that we have the list presented below, we append the element [3, 19] to this list and that we want to print the first
value from each element in the list. What code should we write inside the print command ?
list=[[10,12], [34,5], [8,17]]
list.append([3, 19])
print()
Answer:](https://content.bartleby.com/qna-images/question/918808b3-3bab-4c24-a49a-fe439aaeecc0/f05f7362-6845-4173-a920-f7d9b5482d23/xoywid_thumbnail.png)
Transcribed Image Text:Assume that we have the list presented below, we append the element [3, 19] to this list and that we want to print the first
value from each element in the list. What code should we write inside the print command ?
list=[[10,12], [34,5], [8,17]]
list.append([3, 19])
print()
Answer:
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- PYTHON Suppose that I have a list data = ['BCVCCVCCVCVCB\n', 'BCVCCVCCVCVCB\n', 'BCVCCVCCVCVCB\n', 'BCVCCVCCVCVCB\n', 'BCCCCCCCCCCCB\n', 'BBBBBBBBBBBBB\n'] Now I want to create a new list named (new_data) which has an output as below: new_data = [['B', 'C', 'V', 'C', 'C', 'V', 'C', 'C', 'V', 'C', 'V', 'C', 'B'], ['B', 'C', 'V', 'C', 'C', 'V', 'C', 'C', 'V', 'C', 'V', 'C', 'B'],['B', 'C', 'V', 'C', 'C', 'V', 'C', 'C', 'V', 'C', 'V', 'C', 'B'],['B', 'C', 'V', 'C', 'C', 'V', 'C', 'C', 'V', 'C', 'V', 'C', 'B'],['B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'B'],['B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B']] How can I do this in Python?arrow_forwardusing simple python code. create a list max_val: that returns the maximum value.arrow_forwardI need some help completing this code i am trying to sort the file into 7 columns of data i have listed what i need to do i am just unsure on how i am supposed to do it rows = file.read().splitlines() number_of_cols = len(rows[0]) for c in range(number_of_cols): # todo: create a new list for column c # and have another loop that appends the appropriate data to that column list # then append that column to the return data return return_dataarrow_forward
- Consider the string 'East Dennis, MA 02641'. Split the string into the list ['East Dennis', 'MA', '02641']. Note, that the first element in the list is ‘East Dennis’ without the comma.arrow_forwardIn Kotlin, Create a list that uses your area function as an initializer and contains the areas of circles with each integer from 1 to 25 as radius.arrow_forwarddef remove_after_kth(items, k=1): Given a list of items, some of which may be duplicated, create and return a new list that is otherwise the same as items, but only up to k occurrences of each element are kept, and all occurrences of that element after those first k are discarded. Hint: loop through the items, maintaining a dictionary that remembers how many times you have already seen each element. Update this count as you go, and append each element to the resultlist only if its count is still at most equal to k. items k expected results [42, 42, 42, 42, 42, 42, 42] 3 [42, 42, 42] ['tom', 42, 'bob', 'bob', 99, 'bob', 'tom', 'tom', 99] 2 ['tom', 42, 'bob', 'bob', 99, 'tom', 99] [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1] 1 [1, 2, 3, 4, 5] [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5] 3 [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 1, 5] [42, 42, 42, 99, 99, 17] 0 [ ] Please add comments between the codes so I can understandarrow_forward
- Which operation below is not part of the List interface? add an element to the list remove an element from the list replace an element in the list with another element get the size of the list grow the size of the listarrow_forwardA list will store data in Key: Value pairs. a. True b. Falsearrow_forwardI keep on getting this error g_list.remove(r)ValueError: list.remove(x): x not in listarrow_forward
- In python Create a list from the items in the Bonjoir le monde! String and assign it to the liste variable. Hint: use the list function to built a liste from an it érable sequence (e.g. a string).arrow_forwardWhich of the following assignment statements creates a list with 4 Integer elements? Click on the Correct Response A) my list=[7, 2, -8, 16] B) my_list = integer(4) C) my_list = [4] D) my_list = ['1', '2', '3', '4']arrow_forwardThank you for the response, I was wondering how you do this without using the split function/making it into a list?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education