
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
![3. Write a script to know how many 1's is in the list numbers. Assign that value to the variable
how_many_num. Please do not use a while or for loop to do this.
numbers = [4, 2, 23.4, 9, 343, 9, 1, 234.001, 5, 49, 8, 9, 34, 52, 1, -2, 9.1, 1]
#write your code here
4. Write a script that uses slicing to get rid of the second 17 so that there are only two 17's in
the list to the variable numbers.
numbers = [4, 2, 17, 23.4, 17, 9, 545, 9, 1, 234.001, 5, 49, 17,9, 34, 52, 1, -2, 9.1, 4]
#write your code here](https://content.bartleby.com/qna-images/question/29839555-c663-44f7-ac65-c0a258c24ee3/df2e3fd8-e86c-4cbb-aa91-df5ab61ebb5e/2yais1w_thumbnail.png)
Transcribed Image Text:3. Write a script to know how many 1's is in the list numbers. Assign that value to the variable
how_many_num. Please do not use a while or for loop to do this.
numbers = [4, 2, 23.4, 9, 343, 9, 1, 234.001, 5, 49, 8, 9, 34, 52, 1, -2, 9.1, 1]
#write your code here
4. Write a script that uses slicing to get rid of the second 17 so that there are only two 17's in
the list to the variable numbers.
numbers = [4, 2, 17, 23.4, 17, 9, 545, 9, 1, 234.001, 5, 49, 17,9, 34, 52, 1, -2, 9.1, 4]
#write your code here
![1. Write a script that get the last 5 items in the list teams and assigns it to the variable
last_teams. Your script should get the last 5 items no matter what the size of your list.
teams = ['warriors', 'lakers', 'sixers', 'pistons', 'bulls', 'blazers', 'celtics', 'hawks', 'suns']
#write your code here
2. Write a script that combine the following variables so that the string "How are you doing?
you can do it!" is assigned to the variable newmessage. Do not edit the values assigned
to aa, ab, ac, or ad.
aa = "How are"
ab = "you doing? "
ac = "you can"
ad = "do it!"
#write your code here](https://content.bartleby.com/qna-images/question/29839555-c663-44f7-ac65-c0a258c24ee3/df2e3fd8-e86c-4cbb-aa91-df5ab61ebb5e/2naj3gk_thumbnail.png)
Transcribed Image Text:1. Write a script that get the last 5 items in the list teams and assigns it to the variable
last_teams. Your script should get the last 5 items no matter what the size of your list.
teams = ['warriors', 'lakers', 'sixers', 'pistons', 'bulls', 'blazers', 'celtics', 'hawks', 'suns']
#write your code here
2. Write a script that combine the following variables so that the string "How are you doing?
you can do it!" is assigned to the variable newmessage. Do not edit the values assigned
to aa, ab, ac, or ad.
aa = "How are"
ab = "you doing? "
ac = "you can"
ad = "do it!"
#write your code here
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 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 programming only NEED HELP PLEASEarrow_forwardJS Write a function named list_concat that has a single parameter. This parameter will be a list/array. The parameter's entries will be strings. Your function needs to return a string. The returned string's value should be the concatention of all of the entries in the parameter with a space after each entry. Sample test cases: list_concat(["single"]) evaluates to "single list_concat(["limit", "break", "ready"]) evaluates to "limit break readyarrow_forwardAssume that the variable data refers to the list [5, 3, 7]. Write the expressions that perform the following tasks: a. Replace the value at position o in data with that value's negation. b. Add the value 10 to the end of data. c. Insert the value 22 at position 2 in data. d. Remove the value at position 1 in data. e. Add the values in the list newData to the end of data. f. Locate the index of the value 7 in data, safely. g. Sort the values in data.arrow_forward
- please provide code and explanation with output (list student)arrow_forwardpython LAB: Subtracting list elements from max When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. Write a program that adjusts a list of values by subtracting each value from the maximum value in the list. The input begins with an integer indicating the number of integers that follow.arrow_forward1c) Average sentence length We will create a function ( avg_sentence_len ) to calculate the average sentence length across a piece of text. This function should take text as an input parameter. Within this function: 1. sentences : Use the split() string method to split the input text at every '.'. This will split the text into a list of sentences. Store this in the variable sentences . To keep things simple, we will consider every "." as a sentence separator. (This decision could lead to misleading answers. For example, "Hello Dr. Jacob." is actually a single sentence, but our function will consider this 2 separate sentences). 2. words : Use the split() method to split the input text into a list of separate words, storing this in words . Again, to limit complexity, we will assume that all words are separated by a single space (" "). (So, while "I am going.to see you later" actually has 7 words, since there is no space after the ".", so we will assume the this to contain 6 separate…arrow_forward
- Python code. Please write your own code. Thank you!arrow_forwardPyth pleasearrow_forwardPYTHON Complete the function below, which takes two arguments: data: a list of tweets search_words: a list of search phrases The function should, for each tweet in data, check whether that tweet uses any of the words in the list search_words. If it does, we keep the tweet. If it does not, we ignore the tweet. data = ['ZOOM earnings for Q1 are up 5%', 'Subscriptions at ZOOM have risen to all-time highs, boosting sales', "Got a new Mazda, ZOOM ZOOM Y'ALL!", 'I hate getting up at 8am FOR A STUPID ZOOM MEETING', 'ZOOM execs hint at a decline in earnings following a capital expansion program'] Hint: Consider the example_function below. It takes a list of numbers in numbers and keeps only those that appear in search_numbers. def example_function(numbers, search_numbers): keep = [] for number in numbers: if number in search_numbers(): keep.append(number) return keep def search_words(data, search_words):arrow_forward
- The function count_contains_og in python takes a list of strings and returns how many strings in the list contain 'og' / 'OG' / 'oG' / 'Og' (check for 'og', ignoring case). Hint: Use the sequence membership operator in to help you check for 'og' in the individual strings. Create a lower-cased version of the string (lower), then use the in operator. For example: Test Result str_list = ['cat', 'dog', 'FROG', 'monkey'] print(count_contains_og(str_list)) 2 strlist = ["X", "x"] print(count_contains_og(strlist)) 0 list_of_one_og = ["Doggie"] print(count_contains_og(list_of_one_og)) 1arrow_forwardAs part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again. This program requires a main function and a custom value-returning function. In the main function, code these basic steps in this sequence (intermediate steps may be missing): start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data.within the while loop:for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the…arrow_forwardIn the function below, return the last element (the one at the last index) of the list provided as the parameter called list1. Assume that the argument is 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