Consider the following definition (which is type correct). ys = map reverse xs Select ALL of the following statements that are correct? O ys is a list of numbers The last element in xs is the first element in ys xs can be a list of numbers O xs must be a list of lists
Q: (a) Write an element from the set A x B x C. (b) Write an element from the set B x Ax C. (e) Write…
A: It is defined as a branch of mathematics involving discrete elements that uses algebra and…
Q: Write a program to reverse the strings stored in the following array of pointers to strings: char…
A: Solution:: #include<stdio.h> #include<conio.h> #include<string.h>…
Q: Write a function called is_factor() that takes as input (x), an object. is_factor (x) outputs TRUE…
A: I have provided the answer based on R studio Programming. Detailed comments are included for a…
Q: Write a program which has a class called String, appropriate member functions to get input into an…
A: Given: Write a program that has a class called String, appropriate member functions to get input…
Q: Write a function lastDigits() that takes a list of numbers as parameter, returns a string made of…
A: Required: Write a function lastDigits() that takes a list of numbers as parameter, returns a string…
Q: Given the following function foo , which choice(s) best describes its functionality in general?…
A: Answer : foo returns a new list of elements containing only even integers foo mutates list lst,…
Q: Can you answer with Python programming language ? Write a function that takes two arguments: stock…
A: The program loops through each item in stock for the required item i.e.for the first item in the…
Q: C++ Create a generic function: print_if(start, stop, condition, out) that prints to output stream…
A: Solution -
Q: Write the following function that merges two sorted lists into a new sorted list: void merge(const…
A: solution is given below
Q: Write a function print matching_indexes (items, target) that prints the indexes of all the…
A: The range(start, end, interval) function takes three input arguments. The range function returns the…
Q: Consider the following declaration: int beta [3][3]: What is stored in beta after the following…
A: As per Bartleby's Guidelines: “Since you have posted a question with multiple sub-parts, we will…
Q: For this program, you have to write your own functions for lists without using any of the build-in…
A: Please find the answer below :
Q: Create a function that takes a string of strings and replaces the same members with only numbered…
A: I give the code in Python along with output and code screenshot
Q: Given the following function foo , which choice(s) best describes its functionality in general?…
A: The given function foo() is taking a list of integers as argument. Inside the function, the code is…
Q: How can I ensure the Capital letters are in the right place?"** Explanation 1) Below is program…
A: Here we have the code that reverses the occurrence of the vowel in the string. In the code, we have…
Q: Write a function num_words (string) that takes a string argument and returns a count of the number…
A: Using split() the split function is quite useful and usually quite a generic method to get words out…
Q: Can you compelete the functions ?
A: program:- #include <iostream>#include <map>#include <string>#include…
Q: Can you ask with the Python software language Write a function that takes two arguments: stock and…
A: Python code for the given question - def checkStock(stock, ingr) : # create empty list to…
Q: • Add a function that will convert from Fahrenheit to Celsius; • Add a function showMenu () that…
A: Given C++ program should contain 5 functions namely…
Q: .......Python Code............. Python file: # Write a function that takes an open hockey file and…
A: - We have to code for the dictionary problem.
Q: A = {r| x = 3d + 2, d e N}, B = {x e Z|a? + 9 = 0}, C = {1,5}. Also assume the Universal set is N:…
A:
Q: 14. What would be the return of the following function if (p1;p2) input pair is: "saabrabar";"br"?…
A: ''' Online Python Compiler. Code, Compile, Run and Debug…
Q: Implement the following function without using any additional data structure, and without sorting…
A: ANSWER:-
Q: 7. Express the following sets using the roster method. Express the elements as strings, not…
A: Roster Method: It is used to represent a set or list of elements inside a pair of curly braces. (a).…
Q: Write a function sumLength() that takes a list of strings as parameter, finds and returns the total…
A: ALGORITHM:- 1. Initialize a list of strings with some random strings. 2. Pass the list to the…
Q: Python
A: Introduction of Program Python is a widely-used general-purpose, high-level programming language. It…
Q: ut name of new employee : Mike Menu : 1 . Print full list of employees 2 . Insert new employee 3 .…
A: code : #include <iostream>#include <string>using namespace std; class List{public:…
Q: in javascript create a function that does the following and named as such, please dont copy the…
A: Algorithm Steps:- Initialize an empty Array for the final result Initialize a temporary array to…
Q: Consider the following c++ enumerated data type.A. Declare a variable.B. Write a for loop to…
A: //include the required header files #include <iostream> //use the std namespace using…
Q: works for the selection sort. I need a function that would work using the same logic for the…
A: solution in below step
Q: get tokens_from_equation(line): Takes one string as input that contains any combination of digits…
A: 1) Below is program to define a function get_token_from_equation and test with line inputs It…
Q: A set of integers may be implemented using an array of integers. Since the array is only partially…
A: Note: As you have asked the multipart question, as per our policy we will solve the first three…
Q: Write a function that filters a given list of band names and duplicates the "the", "a", "an" if the…
A: Algorithm - Take array of string in a method as argument. Now loop over the bands legth. use the…
Q: Write the following function that merges two sorted lists into a new sorted list: void…
A: #include <bits/stdc++.h>#include<algorithm>using namespace std;int merge_arrays(int…
Q: # programming exercise import random def make_matrix_random(a, b, у): '' (int, int, int, int)->2D…
A: Python program: #importing the numpy moduleimport numpy as random #given make_matrix_random function…
Q: Write a function that shuffles the rows in a two-dimensional list using the following header:def…
A: //program that shuffles the matrix /*define class*/ public class MyClass{ /** Main method */ public…
Q: Write a function countRange() that takes three parameters, a list and two numbers, finds and returns…
A: I have given an answer in step 2.
Q: Study the defnition of function funArray and answer the question below. void funArray (double…
A: Solution s=0 and m=2 in function i=0 x[0] = x[0] + x[2] => x[0] = 1+5 = 6 I++ i=1 1<2 true…
Q: Using Dr-Racket, what is the purpose of the number function?
A: Given function (define (number n)(local [(define (abstract int)(* int 11))] (build-list n…
Q: Suppose you have a list x = ['a', 'b', 'c, 'd']. Consider the following two programs: A) for i in…
A: for is loop in python which is used for repetition of statements. Enumeration is advanced form of…
Q: function biggest_gap(L) that takes a list L of real numbers
A: Approach As language is not mentioned, the function is written in javascript since two values are…
Q: Implement the following function. 1. void listNumbersAsc(int start, int end);Description: Outputs…
A: Below is the implementation of the function: - Approach: - Define the function listNumbersAsc.(int…
Q: 1. Assume you have the following singly linked List of integers and the method printLL(): Head ↓…
A: Given questions are not interlinked. As per our guidelines only one question will be answered. So,…
Q: Write a program which has a class called String, appropriate member functions to get input into an…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: 1 v import ast lst = input() 4. Pair Of Elements having Smallest Absolute Difference 3 lst =…
A: ALGORITHM:- 1. Initialize the list with the initial numbers. 2. Pass that list to the…
Q: Write a function that takes as a parameter a list of strings and returns a list containing the…
A: Please find the answer below :
Q: python wirte a function max_indexes(xs) that inserts a list xs with numbers and returns a list of…
A: PROGRAM: #Defining max_indexes() def max_indexes(xs): #Defining list to store the…
Q: Higher-order function foldr: (X Y --> Y) Y ListOfX --> Y Which of the below is true? (select two)…
A: Higher-order function foldr: (X Y --> Y) Y ListOfX --> Y Option A And Option C is TRUE.
Q: Using Insertion Sort, Write a python function sort_rectangles that takes rectangle_records and…
A: BECAUSE THE LANGUAGE WAS NOT MENTIONED IN THE QUESTION, FOLLOWING SOLUTION IF IN PYTHON LANGUAGES.…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Using Dr-Racket, what is the purpose of the number function?(define (number n)(local [(define (abstract int)(* int 11))] (build-list n abstract))) A) Create a list of the first n multiples of 11 starting at 11. B) Create a list of the first n multiples of 11 starting at 0. C) Create a list of the first n multiples of 11 starting at 1. D) Create a list of the first 11 multiples of n starting at 1. E) Create a list of the first 11 multiples of n starting at 0.F) Create a list of the first 11 multiples of n starting at n.Q2: Debugging Consider the following function and attempted body."""from typing import TextIOdef allergy_checker(shopping_lists: TextIO,clean_shopping_lists: TextIO, allergies: list[str]) -> None:'''shopping_lists is a file open for reading that has at least one food name on everynon-blank line. Food names are separated by a space.Each line in shopping_lists ends with a newline character.clean_shopping_lists is a file open for writing.allergies is a list of one-word food names.Copy lines from shopping_lists to clean_shopping_lists.For each food name that is in the allergies list, replace it with 'REMOVED'.If a blank line in shopping_lists is reached, stop reading the file.'''shopping_lists = open(shopping_lists) # Line 1clean_shopping_lists = open(clean_shopping_lists, 'w') # Line 2line = shopping_lists.readline() # Line 3while line.strip(): # Line 4line = shopping_lists.readline() # Line 5for i in range(line): # Line 6if line[i] in allergies: # Line 7line[i] = 'REMOVED' # Line…Suppose we use a Python dictionary to store gradebooks of multiple courses. gradebooks = {'Course 1': [['Troy', 92], ['Alice', 95]], 'Course 2': [['James', 89], ['Charles', 100], ['Bryn', 59]], 'Course 3': [['Jack', 74], ['Karren', 97], ['Astha', 92], ['Nancy', 96]]} Use the builtin sorted function with appropriate programming constructs (e.g., lambdas, comprehensions, , etc.) to complete the following tasks: Write code to create a new list named gradebooks_a, with students of each course being sorted by score in descending order. The expected result is: [[['Alice', 95], ['Troy', 92]], [['Charles', 100], ['James', 89], ['Bryn', 59]], [['Karren', 97], ['Nancy', 96], ['Astha', 92], ['Jack', 74]]]
- def find_root4(x, epsilon): ''' IN PYTHON Assume: x, epsilon are floating point numbers and epsilon > 0 Use bisection search to find the following root of x such that If x >=0, return y such that x - epsilon <= y ** 2 <= x + epsilon Else, return y such that x - epsilon <= y ** 7 <= x + epsilon Note: You must use bisection search to implement the function. ''' passImplement a list of employees using a dynamic array of strings.Your solution should include functions for printing list, inserting and removingemployees, and sorting lists (use Bubble sort in C++ language).Keep list of employees sorted within the list after insertion.See the following example:How many employees do you expect to have?5 (Carriage Return)Menu :1 . Print full list of employees2 . Insert new employee3 . Remove employee from list0 . Exit2 (Carriage Return)Input name of new employee : MikeMenu :1 . Print full list of employees2 . Insert new employee3 . Remove employee from list0 . Exit1(Carriage Return)1 . MaryMenu :1 . Print full list of employees2 . Insert new employee3 . Remove employee from list0 . ExitWrite a class that maintains the top 10 scores for a game application, implementthe add and remove functions. use a singlylinked list instead of an array. C++ C++ C++
- Implement the following function without using any additional data structure, and without sorting the input vectors. /* Given two vectors of integers, check if the two vectors contain same set of values: e.g., V1=[3,4,10,4,10,11] and V2=[3,3,4, 11, 10] stores same set int: {3, 4, 10, 11}. Note that duplicates are removed when considering set */ @param list1, list2: two vectors of integers@pre: list1, list2 have been initialized@post: return true if list1 and list2 stores same values (in same or different order); return false, if not. */ bool SameSet (const vector<int> & list1, const vector<int> & list2) {//for each value in list1, check if it appears in list2, if not, return false //for each value in list2, check if the value appears in list1, if not return false //return true}# Create a list of tuplestuples = [("p", 1), ("q", 2), ("r", 3)]# Use enumerate() to iterate over the tuples and print the index and valuefor index, value in enumerate(tuples):print(index, value)This code will print the following output:0 p1 q2 r Could you try to modify your code to get the output mentioned by you? Also, the output for the above function should be0 ('p', 1)1 ('q', 2)2 ('r', 3) Could you please confirm?in javascript create a function that does the following and named as such, please dont copy the already answered question of this in the incorrect manner thank you!! grouper( xs, n ) This function takes a list of elements xs and an integer n. The function groups every n elements in xs as a list and returns a list of those groups. Each group in the resulting list will therefore be of length n, with the possible exception of the final group. The final group must be non-empty. Examples grouper( [1,2,3,4,5], 2 ) => [[1,2], [3,4], [5]] grouper( ['a','b','c','d','e'], 4 ) => [['a','b','c','d'],['e']] grouper( [], 3 ) => []
- In this programming exercise you will implement two functions. The first function will prompt the user for a file containing the number of vertices and entries of the adjacency matrix of a graph. It will return a two-dimensional list (a list of lists) containing the adjacency matrix. The textfile is named inputfilename.txt am trying to read for the matrix [[0, 1, 2, 3, 100, 100, 100, 100], [1, 0, 2, 100, 3, 4, 100, 100], [2, 2 0, 4, 4, 100, 5, 100], [3, 100, 4, 0, 100, 100, 4, 100], [100, 3, 4, 100, 0, 3, 3, 3], [100, 4, 100, 100, 3, 0, 100, 1], [100, 100, 5, 4, 3, 100, 0, 2], [100, 100, 100, 100, 3, 1, 2, 0]] def readMatrix(inputfilename): ''' Returns a two-dimentional array created from the data in the given file. Pre: 'inputfilename' is the name of a text file whose first row contains the number of vertices in a graph and whose subsequent rows contain the rows of the adjacency matrix of the graph. ''' # Open the file f =…Perform the following. 1) Conver the infix expression a/b-c+d*e-a*c into postfix expression and trace that postfix expression for given data a=6, b=3, c=1, d=2 , e=4 .2) A student is asked to develop an application as part of mini project which reverses the order of numbers, such that the number that is placed last in the list will be removed first. The list can hold any number of elements. Implement the following menu based C++program for the same.Write a function countRange() that takes three parameters, a list and two numbers, finds and returns the number of elements that are between the two numbers (both inclusive).Assume that the list contain numbers and the second parameter is less than the third parameter. use=pyhton pls ? and fast answer