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
Given the list x = [20, 40, 30, 10, 20, 40, 60, 80, 10], how many numbers will the following code segment print?
for i in x[2 : 6] :
print(i, end = ' ')
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 2 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
- In C ++ You will need to sort whitespace-separated integers using three different sort algorithms (described here: http://theoryapp.com/selection-insertion-and-bubble-sort/ and https://en.wikipedia.org/wiki/Insertion_sort). For each of the three sorting algorithms (selection, insertion, and bubble), your program should output the initial list of numbers as well as after each swap. Note: You should use the Wikipedia entry for insertion sort. Do not perform swaps if they don't change the vector. Example Input: 1 1 6 3 8 4 2 3 9 2 4 Output: 1 Selection Sort 2 1 6 3 8 4 2 3 9 2 4 3 1 2 3 8 4 6 3 9 2 4 4 1 2 2 8 4 6 3 9 3 4 5 1 2 2 3 4 6 8 9 3 4 6 1 2 2 3 3 6 8 9 4 4 7 1 2 2 3 3 4 8 9 6 4 8 1 2 2 3 3 4 4 9 6 8 9 1 2 2 3 3 4 4 6 9 8 10 1 2 2 3 3 4 4 6 8 9 11 Insertion Sort 12 1 6 3 8 4 2 3 9 2 4 13 1 3 6 8 4 2 3 9 2 4 14 1 3 6 4 8 2 3 9 2 4 15 1 3 4 6 8 2 3 9 2 4 16 1 3 4 6 2 8 3 9 2 4 17 1 3 4 2 6 8 3 9 2 4 18 1 3 2 4 6 8 3 9 2 4 19 1 2 3 4 6 8 3…arrow_forwardI have given you the linear search code example on the video and I want you to go through the code and adjust the code. In the following code, list consists of number 4 twice however when you execute this code you find only the first 4. Please adjust your code to find both 4’s on the list def linear_search(list1,key): for i in range(len(list1)): if key==list1[i]: print("Element is found at index", i) break else: print("The element is not found") list1=[4,5,10,4,9,21] key=int(input("Enter a key number: ")) linear_search(list1,key)arrow_forwardIn python don't import librariesarrow_forward
- Please I need it quickly !!! In python We have a list (named data) of numbers sorted in ascending order, for example: data = [2, 4, 5, 9, 10, 12, 13, 17, 18, 20] Write a function (named DataVar(data)), which take a list (data) as input parameter and performs the following steps on the list: 1) it finds the mean m of the data (for the given example, it is m = (2 + 4 + 5 + 9 + 10 + 12 + 13 + 17 + 18 + 20)/10 =110/10 = 11). 2) then, it finds the difference of data and m. Essentially, it finds for all data: Diff = data-m For the given example, Diff = [-9, -7, -6, -2, -1, 1, 2, 6, 7, 9]. 3) then, it finds the sum of Diff and 7. Essentially, it finds for all data: Sums = Diff+7 For the given example, Sums = [-2, 0, 1, 5, 6, 8, 9, 13, 14, 16]. 4) then, it finds the square of all the elements of Sums, such that Squares = square of the elements of Sums. For the given example, Squares = [4, 0, 1, 25, 36, 64, 81, 169, 196, 256]. 5) it finds the average of Squares and stores it in result, and…arrow_forwardWrite a function little_sum (number_list, limit) that returns the sum of only the numbers in number_list that are less than or equal to the given limit. In this question you must use a for loop and you are not allowed to use the sum function. For example: Test Result numbers = [1, 2, 3, 4, 5, 6] total = little_sum(numbers, 3) print(total) values = [6, 3, 4, 1, 5, 2] 10 total = little_sum(values, 4) print(total)arrow_forwardWrite a function count_evens(nums) that takes a list of ints called nums and returns the number of even ints in the given list. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.arrow_forward
- Write direct sum function for int64_t sum(int64_t N, uint64_t A[])arrow_forwardPYTHON PORGRAM - Write the syntax for defining a for loop (loop index j) that counts backwards from 10 to -10 in steps of 2 and prints the current loop index to screen.arrow_forwardPlease follow all the steps givenarrow_forward
- The function sum_evens in python takes a list of integers and returns the sum of all the even integers in the list. For example: Test Result print(sum_evens([1, 5, 2, 5, 3, 5, 4])) 6 print(sum_evens([5, 5, -5, -5])) 0 print(sum_evens([16, 24, 30])) 70arrow_forwardThe function should be written in python language. Write a function called "zero_triples" to return all triples in a list of integers that sum to zero. You can assume the list won't contain any duplicates, and a triple should not use the same number more than once. [In]: zero_triples([1, 2, 4]) [Out]: [] [In]: zero_triples([-3, 1, 4, 2]) [Out]: [[1, 2, -3]] [In]: zero_triples([-9, 1, -3, 2, 4, 5, -4, -1]) [Out]: [[-9, 4, 5], [1, -3, 2], [-3, 4, -1], [5, -4, -1]]arrow_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
arrow_back_ios
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