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
List pressure_data contains integers read from input, representing data samples from an experiment. Initialize variable sum_passed with 0. Then, for each element in pressure_data that is both at an odd-numbered index and greater than 65:
- Output 'Index ', followed by the element's index, ': ', and the element's value.
- Increase sum_passed by each such element's value.
# Read input and split input into tokens
tokens = input().split()pressure_data = []
for token in tokens:
pressure_data.append(int(token))print(f'All data: {pressure_data}')
''' Your code goes here '''
print(f'Sum of selected elements is: {sum_passed}')
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 this lab, we will practice the use of arrays. We will write a program that follows the steps below: Input 6 numbers from the user user inputs numbers one at a time Loop continuously until the exit condition below: ask the user to search for a query number if the query number is in the list: reports the first location of the query number in the list, change the number in that position to 0, show the updated list if the query number is not in the list: exit the loop You must write at least one new function: findAndReplace(array1,...,query) – take in an array and query number as input (in addition to any other needed inputs); it will return the first location of the query number in the list (or -1 if it is not in the list) and will change the number at that location to 0. You may receive the number inputs and print all outputs in int main if you wish. You may report location based on 0-indexing or 1-indexing (but you need 0-indexing to access the array elements!).arrow_forwardlines of code 1 - 15 CAN NOT be edited. Just need to finish the code.arrow_forwardpython exercise Given the following list: testlist2 = (23,50,12,80,10,90,34,78,4,19,53) Use testlist2 to create Numpy array of int16 and then display the array. Display the number of dimension of testnp. Display the shape of testnp. Display the number of bytes of testnp. Display the mean, sum, max, and min of testnp.arrow_forward
- Integer numElements is read from input and represents: • The number of elements in each array. The number of pairs of integers read from input. Declare two integer arrays, houselds and serviceCosts. Then, read each pair of integers from input. For each pair read, store the first integer into houselds and the second integer into serviceCosts. Ex: If the input is: 4 3 29 9 12 8 18 5 46 then the output is: House id: 3, Costs: $29 House id: 9, Costs: $12 House id: 8, Costs: $18 House id: 5, Costs: $46 1 import java.util.Scanner; 2 3 public class CashRecords { 4 5 16780 O 9 public static void main(String[] args) { Scanner scnr= new Scanner (System.in); int numElements; int i; numElements scnr. nextInt (); /* Your code goes here */ for (i = 0; i< numElements; ++i) { System.out.println("House id: + houseIds[i] + ", Costs: $" + serviceCosts [i]); 10 11 12 13 14 15 16 } 17 } }arrow_forwardGive me correct code. Downvote for incorrect and copied code. Changes in function..arrow_forwardWhat transpires when a parameter for an array is sent in with either the ref or out keyword, and the results are observed?arrow_forward
- python 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_forwardThe top three most popular male names of 2017 are Oliver, Declan, and Henry, according to babynames.com. Write a program that modifies the male_names set by removing a name and adding a different name. Sample output with inputs: 'Oliver' 'Atlas' { 'Atlas', 'Declan', 'Henry' } NOTE: Because sets are unordered, the order in which the names in male_names appear may differ from above. Code writing challenge activity demo 461710.3116374.qx3zqy7 1 male_names 2 name_to_remove = input() 3 name_to_add=input() 4 = 11 { 'Oliver', 'Declan', 'Henry' } 5 6 7 print (male_names) Your solution goes here '''arrow_forwardPrompt: In Python language, write a function that applies the logistic sigmoid function to all elements of a NumPy array. Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def sigmoid(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-100, 100, 0.5) outputs = sigmoid(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs,'Black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()arrow_forward
- Please follow all the steps givenarrow_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_forwardThe 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_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