Write an algorithm that create a list C that contains only those elements that are common in list A and B
Q: 2 Write a program to find the two largest ALmbers from a list. for example: From the list,…
A: #note no programming language is mentioned so I was used python programming print("enter the comma…
Q: 2. Write a program that search a letter in a list. Save it as searchLet.py. a) Create a list named…
A: The program is written in python that accomplishes the points mentioned.
Q: Implement the following: 1) Store the following data into a list: 5 10 15 2) Use list methods to…
A: Common method of python list 1) insert(i,e) It is used to add element e at index i of list. Example…
Q: if(l.size() b) I.set(0,b): I.set(l.size()-1, a); Exchanges the elements in the first and the…
A: The given code returns false if list size is less than or equal to 1 else the code stores 1st…
Q: 1.1 Input text is an unsorted list of strings. Each string contains only lowercase a-z characters.…
A: Solution: 1. Implemenation of lex_pos() method: # this method returns the list of numbers# which…
Q: Python Write a function revers_all (sequence) that takes an arbitrary nested list sequence with…
A: 1) Below is program that defines a function reverse_all which reverses nested list It defines…
Q: Let assume we have a list of numbers contains even and odd numbers , so you need to build an…
A: Step 1: Initialize two lists to store the odd and even numbers. Step 2: Iterate through the items of…
Q: A chain letter starts with a person sending a letter out to 10 others. Each person is asked to send…
A:
Q: Write a program that has all operation of Circular Linked Lists: –Initialize the list (to an empty…
A: /* * C++ Program to Implement Circular Linked List…
Q: 7-Write a procedure that returns the list that contains everything except for the last element of…
A: first we have to write scheme code and then run that code on an scheme compiler: As per the example…
Q: The following is useful as part of a program to play Minesweeper. Suppose you have a 5×5 list that…
A: Python program for above : def Count( M_swap , i, j): count = 0 if( i-1 >= 0 and…
Q: Write a function that takes a nested list of integers and add up the elements from all of the nested…
A: For nested list, you can iterate over a list and then use sum function or you can iterate over that…
Q: A linked list is a series of nodes, where each node in the list points to the next. The last node…
A: A node is a structure name that consists of a value data member, and the next is the pointer…
Q: L1, L2 are two integer lists, to insert an integer X at the end of the list that has less number of…
A: Given :- Two lists L1 and L2. First there is need to calculate the size of both the lists in order…
Q: Following Exercise-2 (Available under Week-5 on moodle), create your list (of 5 elements) and…
A: CODE: # creating an empty list lst = [] # number of elemetns as input n = int(input("Enter number of…
Q: Implement a Polynomial ADT using Linked Lists, Please Implement the Multiplication, Addition, and…
A: What is polynomial: A polynomial p(x) is the expression in variable x which is in the form (axn +…
Q: PROGRAMMING EXERCISE 5-3 Write a program to take two numerical lists of the same length ended with…
A: According to the Question below the Solution: According to the Policy i can solve only one…
Q: Part 1. Write a python program that does the following: 1. Create a list of length N where N…
A: Find Your Code Below
Q: (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store…
A: EXPLANATION: You are program works correctly. But your issue based on the software. Use Python…
Q: ocode to find the average value in a list h
A: Below the pseudocode to find the average value in a list has 10 integer values.
Q: Write a function that takes in two ADT Lists, the function will be called Intercalate, it will…
A: void intercalate(int*list1[], int*list2[],int*listResult[]){ int num1 =0; int num2 =0; int num3 =0;…
Q: Write a function summax2 : int list -> int - that takes an int list and returns the sum of the 2…
A: I give the code in Python along with output and code screenshot
Q: Develop an algorithm to calculate the average of the elements of a list x. Implement your algorithm…
A: Program Plan: Define calculateAverage() function that calculates the average of the list. Input the…
Q: INPACKING LIST PROBLEM: Unpack the list writeyourcodehere into three variables, being first, iddle,…
A: Code is given below lst = [1,2,3,4,5,6] print('First: ',lst[0]) print('Middle: ',lst[1:-1])…
Q: write a function that add any item in a linked list after the item X, if the item X is not found in…
A: Given: write a function that add any item in a linked list after the item X, if the item X is not…
Q: 2. Write a program that search a letter in a list. Save it as searchLet.py. a) Create a list named…
A: Programming instructions: Create a list. Take input from the user. If the user enters only one…
Q: Write a sequence of List operations that would result to a LIST that contains ONLY the elements with…
A: Code: List = [00, 1, 2, 3, 4, 5]List1 = [104, 165, 115, 384, 248, 117]print("\nList of numbers:…
Q: If I double the number of items in a sorted list of numbers, all algorithms will take twice as long…
A: Answer for all given below with explanation
Q: Using the Link codes, write a program to implement the following operations: 1) Create a list that…
A: using Link code in C++ to create list of element . Display list of element and delete one element…
Q: (1)Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store…
A: Program: Your program is perfectly correct. Kindly run your code in…
Q: Implement a Polynomial ADT using Linked Lists, Please Implement the Multiplication, Addition, and…
A: Here is the solution to the above problem: - CODE: #include<math.h> #include<stdio.h>…
Q: type comparison = GEQ | LT Where GEQ represents "greater than or equal" and LT represents "less…
A: It is defined as the most important language in the Machine Learning concept. OCaml adds advanced…
Q: Create a Flowchart for this code. #Declaring and initializing the list cars =…
A:
Q: 2. Write a program that will take a string from the user. The program needs to store all of the…
A: Python program for above : # get the string from user str = input("Enter a string: ") # store…
Q: Considering all the elements and its indexes at the right side: Write a sequence of List operations…
A: The answer is given below:-
Q: 1. Write a Python program that prompts the user to enter a sentence of at least 5 words. Include a…
A: #read input from user s=input() #split input into words l=list(s.split()) #print words in reverse…
Q: (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store…
A: Program: #create an empty list to store wt wt = [] # (1) #get the four wt from the user for i in…
Q: A linked list is a series of nodes, where each node in the list points to the next. The last node…
A: #include <iostream>#include <string>using namespace std; struct Node{ int value;…
Q: Assuming that data is a correctly created list, then the fact that lists are mutable means that the…
A: Since the python follows the zero indexing rule, there must be at least 10 elements inside the list…
Q: Let assume we have a list of numbers contains even and odd numbers, so you need to build an…
A: Solution: Python code: # A Lomuto partition based scheme to# segregate even and odd numbers. #…
Q: Complete the examples in the docstring and then write the body of the following function: def…
A: def same_first_last(L):""" (list) -> boolPrecondition: len(L) >= 2Return True if and only if…
Q: python- Write a function called get_words that takes a list of words and a letter, and returns a…
A: #method that takes list of words and a letter#then returns new list words which dont have the given…
Q: 1. Write a program to get the first and last element for the linked list. The Elements are…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: We have a list. For example [2,4,6,6,8,2,12,54,15]. Without repeating the elements in the list a new…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: Write list comprehensions to generate the following: i) If numlist contains a list of numbers,…
A: The PYTHON code is given below with code and output screenshot Happy Coding ?
Q: Implement a doubly linked list. The name of the nodes of the list should be Customer. Each node will…
A: Actually, program is a executable software that runs on a computer.
There are two static lists A and B containing the following data:
A: 2,5,9,14,15,7,20,17,30
B: 14,2,9,13,37,8,7,28
1. Write an
2. Write an algorithm that create a list D that contains all elements of A as well as B ensuring that there is no repetition of elements
3. For Question 1, calculate the running time to create and fill the list C
Note: Only use operations of List A and List B for designing algorithms in part (a) and (b)
Step by step
Solved in 2 steps
- ) Write list comprehensions to generate the following:i) If numlist contains a list of numbers, create a new list that contains only thosenumbers that are less than 100. (e.g. [42, 130, 7, 100, 101] becomes [42, 7])ii) The numbers from 3 to 30 that are multiples of 3 (i.e. 3, 6, 9, 12, 15... 30)iii) The numbers from 3 to 30 that are multiples of both 3 and 2 (i.e. 6, 12, 18...)iv) If wordlist contains a list of strings, create a new list that has the words that startwith “p” or “P”. (e.g. [“Apple”, “pear”, “avocado”, “Pumpkin”] becomes[“pear”,”Pumpkin”] )A student writes a program that for any two lists L1 and L2, computes a list L3 that contains only the elements that are common between the two lists *without duplicates*. Which following statement makes the following portion of code that computes L3 correct: L3 = [] # line 1 for elem in L1: # line 2 if elem in L2: # line 3 L3.append(elem) # line 4We have a list. For example [2,4,6,6,8,2,12,54,15]. Without repeating the elements in the list a new list that does not repeat its elements by creating and using the function that writes Create.
- Implement the following:1) Store the following data into a list: 5 10 152) Use list methods to modify the list to the following: 3 5 8 10 12 173. Print each element of the list separated by a '|'. Just make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).Example Output3 | 5 | 8 | 10 | 12 | 17 |Create a program that removes duplicate integer values from a list. For example if a list has these valuesList = [5, 7, 8, 10, 8, 5, 12, 15, 12]. After applying the removal function, you should have List = [5, 7, 8,10, 12, 15]. In your case you will get the numbers of list from the user.In python, create a function wherein you transfer elements from a list into different lists. If a certain element has been encountered, continue the listing in a new list. Continue doing so until this certain element has been encountered two times. Disregard the succeeding elements after the second certain element. Once you have your 2 lists, return them both as a tuple. Example: element_stop = ‘a’ original_list = [‘b’, ‘c’, ‘d’, ‘d’, ‘f’, ‘a’, ‘e’, ‘t’, ‘d’, ‘g’, ‘f’, ‘t’, ‘a’, ‘b’, ‘e’] The output should be: ([‘b’, ‘c’, ‘d’, ‘d’, ‘f’], [‘e’, ‘t’, ‘d’, ‘g’, ‘f’, ‘t’])
- Write a function that will accept a list of integers and return the sum of the contents of the list(……if the list contains 1,2,3 it will return 6…..)Considering all the elements and its indexes at the right side:Write a sequence of List operations that would result to a LIST that contains ONLY the elements with its respective indexes: {index[00]=104, index[01]=165, index[02]=115, index[03]=384, index[04]=248, index[05]=117}.Write the following function that sorts and merges two lists into a new sorted list. The new list contains only even numbers. def myMergeEvenList(list1, list2): Enter list1: 10,5,6,7 Enter list2: 12,8,5,0,1 The merged list is: 0,6,8,10,12
- Complete the reverse_list() function that returns a new string list containing all contents in the parameter but in reverse order. Ex: If the input list is: ['a', 'b', 'c'] then the returned list will be: ['c', 'b', 'a'] Note: Use a for loop. DO NOT use reverse() or reversed(). This is my code so far: def reverse_list(letters): for x in (letters): letters.sort(reverse=True) return lettersif __name__ == '__main__': ch = ['a', 'b', 'c'] print(reverse_list(ch)) # Should print ['c', 'b', 'a'] When submitting I get 4/10 and it says: Test input list ['a', 'b', 'c'] returns ['c', 'b', 'a'] Your output reverse_list() function reversed array incorrectly: ['c', 'b', 'a'] reverse_list() function should have returned: ['a', 'b', 'c'] Test input list ['a', 'b', 'c', 'd'], first element of returned list is ['d'] Your output First character of returned array should be a instead of d Test empty input array TypeError: object of type 'NoneType' has no len()Assume, you have been given two lists. Your task is to multiply the first element of the first list, to the last element of the second list and store them in another list. Then, again multiply the second element of the first list, to the second last element of the second list, and so on. If any of your lists is out of element, and another list has some elements remaining, then just append the remaining elements to your final list and print the list.================================================ Given lists 1:list_one = [1, 4, 7, 5]list_two = [6, 1, 3, 9] Sample Output 1:[9, 12, 7, 30] Explanation 01: Here, from list_one’s 1st element, 1 has been multiplied with the last element of list_two 9. So, the product 1X9 =9 has been added to the answer. Then, from list_one’s 2nd element, 4 has been multiplied with the 2nd the last element of list_two 3. So, the product 3X4 =12 has been added to the answer. And so on. ================================================Given lists 2:list_one =…please code in python Create a program that takes in a string of words separated by spaces. Create a list with each of those words in order without using list comprehension. Next, use list comprehension to generate a new list where only the words that are proper nouns (capitalized) appear.