Write a function convert_to_millimetres (measurements) which takes a list of measurements in centimetres as a parameter and modifies that list by replacing each measurement with its millimetres version, which involves multiplying by 10. You will need to use the updated-list pattern. (Note that there's no need to return anything because the function modifies the original list it was given.) For example: Test Result measurements = [10.0, 25.0, 1.0] convert_to_millimetres (measurements) [30.0, 75.0, 3.0] print (measurements)
Q: Write a function starting_A that takes a list of strings called words as a parameter, and returns a…
A: Hi. As you have not mentioned any programming language, I will attempt it using Python. Let's…
Q: Write a function remove_smallest() that gets a dictionary as a parameter and remove the item which…
A: def remove_smallest(data): #find min value in dict value=min(data.values()) #create new…
Q: Write a function that takes three lists of integers, l1, l2, and l3, and returns a list of all…
A: Note: Below is the required program in python language. Program Approach: Define a function that…
Q: Write a program that first gets a list of six integers from input. The first five values are the…
A: Program: //include the required header file #include<iostream> using namespace std; void…
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: According to the Question below the Solution: Output:
Q: Write a program that gets a list of integers from input, and outputs the integers in ascending order…
A: Program:#include<iostream>#include<vector> using namespace std; void…
Q: Write a function char_counts(string) that takes a string as a parameter and returns a dictionary in…
A: Solution a) We have to use a dictionary as a parameter to take input from the user and then find the…
Q: e list. A bottom value is less than its predecessor and its successor. Assume that the list contains…
A: def countBottom(nums): count=0; for x in range (1,len(nums)-1):…
Q: PYTHON!!! Implement a function insert_sorted, which will insert a string into its appropriate…
A: Note: list.sort(): if list is of strings then, it will sort them in alphabetical order.
Q: Given both a list x and a tuple y, write a function called sum_list_andOr_tuple that sums all the…
A: NOTE : Since programming language is not mentioned.Therefore answering in Python language. First…
Q: Write a function count_repeated that takes two lists as a parameters and prints out the number of…
A: I give the code in Python along with output and code screenshot
Q: Implement the FindText() function, which has two strings as parameters. The first parameter is the…
A: #include <iostream>using namespace std;int FindText(const string &text,string…
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: Write a function MedianWithoutHL(ScoreList) that takes an unsorted list of n numbers as a parameter,…
A: Explanation Step by step algorithm create an array of double and fill the array with user…
Q: Write a function differBy which takes two arguments, a number N and a list of numbers L, and returns…
A: ; (write-line "Hello World") (defun differBy (N list-data) (setq ans nil) ; initialize list to…
Q: Write a function called count_superheroes () that takes a list (containing the strings 'Spiderman'…
A: Python3 Code:def count_superheroes(heroes): spidy=0 # Variable to store the count of Spiderman in…
Q: Use the Design Recipe to write a function, count_odds, that consumes a list and two integers,…
A: Below is the required Python program: - Approach: - Define the function count_odds that take three…
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: Write a Python function peaksIndex() that takes a list as parameter, returns a list that contains…
A: def peaksIndex(arr): peaks=[] #for storing indexes of peak values for i in…
Q: Write a function that takes a string as its only argument and returns a sorted list of characters…
A: #definition of the functiondef strLetters(iStr): #create one empty list a = [] #convert…
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: Write a function that will accept a dictionary as the input parameter and return a new dictionary…
A: Hi. As there is no programming language mentioned, I will attempt this question using Python.…
Q: Using the function provided, write a function that decides whether two lists are "identical". That…
A: Step 1: Define the function identical() which takes two lists as arguments. Step 2: Check whether…
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: Here I have created a function named name_processor(). In this function, I have iterated over the…
Q: Write a function addToAll(Ist, x) which takes a list of integers and a number and modifies the list…
A: Iterate over the given list and update element by adding x value to it
Q: Write a function getOdds() that takes a list of integer numbers as parameter, returns a new list…
A: def getOdds(inList): outList=[] for num in inList: if num%2!=0:…
Q: Write a function called remove_odd that takes a list of numbers that have both even and odd numbers…
A: Given: Write a function called remove_odd that takes a list of numbers that have both even and odd…
Q: Write a Python function which should take two arguments (string and a list) and return yes/no based…
A: Here in the function typeOf() I have first of all checked the string for int, str, list type. Then I…
Q: (2) Now implement a convert_words() function, which has a list of words as a parameter, and returns…
A: In this following are the variables, functions, and formulae are used to calculate and display the…
Q: Write the following function to sort a list of points on their y-coordinates. Each point is a list…
A: Code def sort(a): n = len(a) for i in range(n): for j in range(n-1): if…
Q: Write a function named add_surname that takes as a parameter a list of first names. It should use a…
A: A list comprehension consists of brackets containing an expression followed by a for clause, then…
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: Given a list of items with a value, and a start and end flag, implement a function that calls…
A: Answer is given below-
Q: Write a function that takes a string as its only argument and returns a sorted list of characters…
A: code :-- def strLetters(istr): # convert into lower letter istr = istr.lower() # to store…
Q: Write a function that takes a string as its only argument and returns a sorted list of characters…
A: #definition of the functiondef strLetters(iStr): #create one empty list a = [] #convert…
Q: Our second pattern is the mapped list pattern, described in video 4 3 mapped list pattern. Often we…
A: The for loop in Python is used to iterate the statements or a part of the program several times. The…
Q: Create a list that repeats the names of the Three Stooges (Moe, Larry, Shemp) in order infinitely…
A: Answer 1) Program: factorial n =product [1.n] main = do Let = 5 print(factorial n) Screenshot: (for…
Q: Complete the calc_average() function that has an integer list parameter and returns the average…
A: The Python program along with the snapshot of code and output is given below:
Q: Write a Python function peaksIndex() that takes a list as parameter, returns a list that contains…
A: def peaksIndex(listA): # function to return the list of indexes with peak values N =…
Q: Write a function removeRange() that takes a list of integer numbers and two integer numbers as…
A: Program in C++ to delete the elements of array and copy the rest elements to another array and…
Q: For each function call below, indicate if it is correct. If a function call is correct, show what is…
A: Lists are one of the four built-in data structures in Python. Other data structures that you might…
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: rite a function numPairs that accepts two arguments, a target number and a list of numbers. The…
A: The complete code is given below.
Q: Write a program in PYTHON with a function longest(L) which examines the argument list L and returns…
A: Here i write python code for given longest string from list problem.
Q: Write a function that takes a list of lists and then returns the value of all the symbols in it,…
A: Algorithm - Create a map with respective values of the symbols Define a method that returns the…
Q: Write a function named listReplace that takes 3 arguments: list1, tuple1, and tuple2. The function…
A: PROGRAM EXPLANATION: Define a function list Replace. This function will receive 3 arguments: list1,…
Q: Write a function called `filler(A, l)` that takes an integer `A`, and a list of integers `l` and…
A: Code: #import combinations from itertools from itertools import combinations #function called filler…
Q: For all questions on Part 2, you may not use any built-in functions or methods other than nge, len,…
A: PROGRAM CODE: def is_balanced(num_list): n =len(num_list) first_half_sum = 0 last_half_sum…
Q: Implement a function pairsThatSum that accepts two arguments: 1. a target number 2. a list of…
A: #function pairsThatSum that accepts two arguments: 1. a target number 2. a list of numbersdef…
Q: In python, remove_from_list(my_list, indices): Takes two lists as input. Creates a new list from…
A: 1. create an empty list 2. iterate over the list of words 2.1 if i is in the list of indexes then…
Step by step
Solved in 2 steps with 1 images
- Write a function convert_to_millimetres (measurements) which takes a list of measurements in centimetres as a parameter and modifies that list by replacing each measurement with its millimetres version, which involves multiplying by 10. You will need to use the updated-list pattern. (Note that there's no need to return anything because the function modifies the original list it was given.) For example: Test Result measurements = [10.0, 25.0, 1.0] convert_to_millimetres(measurements) print (measurements) [30.0, 75.0, 3.0]Write a function called count_superheroes () that takes a list (containing the strings 'Spiderman' and 'Hulk') as a parameter and returns the string 'Spiderman' if Spiderman appears more times in the list than the Hulk; returns the string 'Hulk' if the Hulk appears more times in the list than Spiderman; and returns 'even' otherwise. You MUST use a loop in your solution. You must not use string methods or list methods in your solution. If you didn't complete part a), you may assume that you did in order to answer this question. For example: If the list being passed as an argument to function count_superheroes () is: superheros ['Spiderman', 'Hulk', 'Spiderman', 'Hulk', 'Spiderman', 'Spiderman', 'Hulk'] the function will return the string 'Spiderman' (i.e. the string 'Spiderman' appears in the list more times than the 'Hulk'). =Write a function called find_duplicates which accepts one list as a parameter. This function needs to sort through the list passed to it and find values that are duplicated in the list. The duplicated values should be compiled into another list which the function will return. No matter how many times a word is duplicated, it should only be added once to the duplicates list. NB: Only write the function. Do not call it. For example: Test Result random_words = ("remember","snakes","nappy","rough","dusty","judicious","brainy","shop","light","straw","quickest", "adventurous","yielding","grandiose","replace","fat","wipe","happy","brainy","shop","light","straw", "quickest","adventurous","yielding","grandiose","motion","gaudy","precede","medical","park","flowers", "noiseless","blade","hanging","whistle","event","slip") print(find_duplicates(sorted(random_words))) ['adventurous', 'brainy', 'grandiose', 'light', 'quickest', 'shop', 'straw', 'yielding']…
- About initial programming in python: Create a function that receives as parameters a list of 4 elements [name,[phone(s)], email, instagram] and a phone number:• If the phone number is in the list, it must be removed.• If not, no updates will be made. Note: phone(s) is within another list. Your function should only return a Boolean value, indicating whether the change was made or not. To find out if the function did the phone deletion correctly, you should check the contents of the list with the contact details you used to test your function after executing it. In the image is the model of parameters, in this case the function must exclude from the list of 4 elements the indicated number '44322456' and return "True".Using JavaScriptDefine a function getMonth which accepts number from 1 to 12 as an argument and return the descriptive name of the month. For example: getMonth(1) should return January while getMonth(12) returns December, finally getMonth(-1) returns null. Use array or object to define a list of names for the month and refrain from using if statement to check the argument if it's 1, 2, etc.from surround import surround inputs = [] [] answers = L = ["tank", "godzilla", "tank"] ["tank"] inputs.append (L) answers.append(a) a = TESTS len(inputs) passed = 0 for i in range(TESTS): try: result = surround (inputs[i]) if result not in answers[i]: print("Error found for input: " + str(inputs[i])) else: passed += 1 except Exception: pass result = "Tests passed: + str(passed) + "/" + str(TESTS) print(result)
- Write a function MedianWithoutHL(ScoreList) that takes an unsorted list of n numbers as a parameter, discards the highest and the lowest numbers and return the median. You can assume the number of items in the list is between 0.0 and 9.9. To find the median from a list of items, you have tosort the list and find out the value of the item in the middle.Note: If the list has an odd number of items, the median is the value of the middle item. If the list has an even number of items, the median is the average of the two middle items.Sample Run #1:scoreList1 = [9.0, 9.0, 7.5, 8.0, 9.5, 6.5, 5.0, 7.0, 7.5, 8.5]print("The Original ScoreList: ", scoreList1)print(MedianWithoutHL(scoreList1))Output of Sample Run #1:The Original ScoreList: [9.0, 9.0, 7.5, 8.0, 9.5, 6.5, 5.0, 7.0, 7.5, 8.5]The List after sorting: [5.0, 6.5, 7.0, 7.5, 7.5, 8.0, 8.5, 9.0, 9.0, 9.5]Without the High & Low: [6.5, 7.0, 7.5, 7.5, 8.0, 8.5, 9.0, 9.0]7.75Write a function updateList() that takes a two-dimensional list of numbers (e.g., a list of lists containing float and int values) representing measurements and a numeric parameter n and modifies the list so that each value smaller than n is replaced by n. The function does not return any values but instead modifies the list provided as a parameter. The function is also not allowed to create a new list, since the parameter list must be modified. You should assume that the list given to the function will contain numbers and that the second parameter will also be a number (e.g., an int or float), and your function does not have to behave reasonably on any other types of parameters. Note that the list may be empty, in which case it will obviously not be changed by the function. The following shows some sample interactions with the completed function. Note that these examples are just that, and your function must work correctly on any two-dimensional list of numbers:this code should be in python: write a function that receives a list as its only parameter. Inside the function remove all the duplicate items from the list and returns a new list. For Example: If we call the function with [“dad”, “aunt”, “mom”, “sister”, “mom”] as its input, the returned value should be [“dad”, “aunt”, “mom”, “sister”]. The order of the items inside the returned list does not matter.
- in c++ : The function insert of the class orderedLinkedList does not check if the item to be inserted is already in the list; that is, it does not check for duplicates. Rewrite the definition of the function insert so that before inserting the item it checks whether the item to be inserted is already in the list. If the item to be inserted is already in the list, the function outputs an appropriate error message. Also write a program to test your function (in the driver file).4. Modify the bracketsBalance function so that the caller can supply the brackets to match as arguments to this function. The second argument should be a list of beginning brackets, and the third argument should be a list of ending brackets. The pairs of brackets at each position in the two lists should match; that is, position 0 in the two lists might have [ and], respectively. You should be able to modify the code for the function so that it does not reference literal bracket symbols, but just uses the list arguments. (Hint: The method index returns the position of an item in a list.) the bracketsBalance function: def bracketsBalance(exp):"""exp is a string that represents the expression""" stk = LinkedStack() for ch in exp: if ch in [’[’, ’(’]: stk.push(ch) elif ch in [’]’, ’)’]: if stk.isEmpty(): # Create a new stack # Scan across the expression # Push an opening bracket # Process a closing bracket# Not balanced return FalsechFromStack = stk.pop()# Brackets must be of…You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of the linked list formed after inserting this new node. The given head pointer may be null, meaning that the initial list is empty. Function Description Complete the insertNodeAtTail function in the editor below. insertNodeAtTail has the following parameters: SinglyLinkedListNode pointer head: a reference to the head of a list int data: the data value for the node to insert Returns SinglyLinkedListNode pointer: reference to the head of the modified linked list Input Format The first line contains an integer , the number of elements in the linked list.The next lines contain an integer each, the value that needs to be inserted at tail. Constraints Sample Input STDIN Function ----- -------- 5 size of linked list n = 5 141 linked list data values…