the function has two lists (list1 and list2) and does the following for the return: return [list1, list2] What was returned from this function? a. A new list with data of list1 and list2 combined b. A new list with 2 elements: list1 and list2 c. A new tuple with the data of list1 and list2 combined d. A new tuple with 2 elements: list1 and list2
Q: Write a function that takes list and a number (x) as parameters. Assume list contains only numbers,…
A: - We need to solve the number list problem in python.
Q: Write and test a function shuffle (my List ) that scrambles a list into arandom order, like…
A: Given: Write and test a function shuffle (my List ) that scrambles a list into arandom order, like…
Q: 8. Write a function indices(L) that takes a list and returns a dictionary containing lists of…
A: Task :- Write a python program that takes a list and returns a dictionary containing lists of…
Q: The function below was supposed to return True if the second parameter val showed up in the…
A: Please refer below for your reference: Language used is Python: def some_function(a,val): for i…
Q: (python) If the function has two lists (list1 and list2) and does the following for the return:…
A: 1) In Python Function can return as many value as you want by separating the values by commas 2) If…
Q: You have been asked to write a function that supplies the "reverse lookup" name for the person…
A: 1) Below is the updated program to return name for the person associated with phone_num It defines…
Q: Use Standard ML Code: Write a function that returns the factorial of a number. Write a function…
A: The above question is solved in step 2:-
Q: Create a function: That takes a list and an integer v, -And returns True if the value v is in the…
A: Code will return the loop will run how many times. And this is the python code.
Q: In PYTHON Given a list of ints, a start index, and an end index (not inclusive), function should…
A: Below is the code in python and sample output:
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: Exercise : Create a program that asks the user to create 2 lists composed of 5 numbers each. 2…
A: """Program to get two list from user of 5 numbers each, remove duplicatesand print list in reverse…
Q: Write a function combine(names, ages) that takes in two lists, names and ages and returns a list of…
A: The program requires combining two lists in the form of key-value pairs where the first list the key…
Q: It returns how many times the number is found in the list. If the number is not in the list, return…
A: def how_many(a_list,a_num): count=0 #initializing count is zero for i in…
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: Write a function numPairs that accepts two arguments, a target number and a list of numbers. The…
A: below is the code for given python program:
Q: Given two dictionaries d1 and d2, write a function combine_dict(d1, d2), which return a new…
A: Python code to perform the rule for combine dictionary is given below, hope you like it.
Q: • Complete the examples in the docstring and then write the body of the following function: def…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Write a function convert_to_millimetres (measurements) which takes a list of measurements in…
A: def convert_to_millimetres(measurements): for i in range(len(measurements)):…
Q: 8. Write a function called starts_with that takes as parameter a list of strings called words and…
A: The following are steps need to be taken for the given program: Initializing an empty dictionary…
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: Write a function list2DigitOdd() that creates and returns a list that contain all positive 2-digit…
A: I have given an answer in step 2.
Q: 3 Write a function to generate a date string given numeric values for month, day, and year, and a…
A: dictornary = {1: ('January', 'Janvier', 'Januar'), 2: ('February', 'Février',…
Q: Write a function verifsort that accepts a list as a parameter, check if the list elements are sorted…
A: #include <iostream>using namespace std; int verifsort(int arr[]){ /* If list is in…
Q: Using "import csv" call file2file with the parameters "file.csv" and "file.txt". Your function…
A: import csvwith open('file.csv', 'r') as readCsv:#opening csv file in readmode #creating reader…
Q: Write a function is Prime (a_nNum) that takes a positive integer as an argument and returns True if…
A: Here is the python code. See below step for code and output:
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 function indice_de that takes as an argument an integer (supposedly even) and a list, and…
A: As per our guidelines we are supposed to answer only one question kindly repost other question as a…
Q: Given two lists A and B, write a function to compute the difference A – B, where A – B is the list…
A: 1) Since you have not specified programming language, I have written program in python language 2)…
Q: Python, A. Write a function that accepts a list of integers as an argument and prints the list's…
A: Answer:
Q: Introduction In this lab, you are writing a function slashes_to_written(date_list) that gets the…
A: def slashes_to_written(date_list): month_names = { 1: "January", 2: "February", 3: "March", 4:…
Q: Using the function provided, write a function that decides whether two lists are "identical". That…
A: Please find the answer below
Q: Write a function that will accept a list of integers and return the sum of the contents of the…
A:
Q: 1) Write a function that takes one argument, a list named sample-list. 2 ) If the length of the…
A: Task :- Write a python program for given question. Python program :- def fun(sample_list):…
Q: how to write a function in python 3 that take a tuple t = (7,8,4,20,11) and returns a list which…
A: Note: The below program has been complied and executed in “repl.it” online complier
Q: Write a function that takes a list as an input and returns all the pairs of numbers whose GCD…
A: Here, we have to write python program to find the pairs whose gcd is 1.
Q: Write a function that accepts two arguments, a list and a number n. The list contains numbers. The…
A: here in this question we have asked to write a program which take a list and an integer input from…
Q: (Note: this is a searching problem. Your function should return 1 to mean “Yes, the word is in the…
A: THE CODE HAS BEEN WRITTEN IN STEP 2. I HOPE YOU FIND THIS HELPFUL.
Q: You'll write a function altSum(1st: list[int]) -> int that takes a list of numbers and returns the…
A: Here I have created a function named altSum(). In this function, I have checked for the size of the…
Q: Write a single function • that squares each item of a list, t • then sums all the items in the list,…
A: The required code for the python program is provided in the next step.
Q: True or false? When a list is passed to a function, a new list is created and passed to the…
A: List List is used to store the multiple items in the single variable. Items in list are changeable,…
Q: Create a function that takes two numbers as arguments (num, length) and returns a list of multiples…
A: # As no language is mentioned, the program is written in Python language. def…
Q: (Note: Do not read input, instead use the arguments to the function. Do not print the output,…
A: Note: As any programming language is not mentioned in the question So I am using Python to write…
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 called contains_range(x, y, values), which returns True if the list of integers…
A: code : - def contains_range(a,b, values): # if list is empty than return False if not…
Q: b. Write a function cutL2 that removes the last two items from a list given as its argument The…
A: - For doing this we have to pass the list as with reference. - We are using C++ here. - We will…
Q: Write a function called reverse_list that takes in a list and returns the reverse of the list. E.g.,…
A: The above question is solved in step 2 :-
Q: Write a function that accepts a list of numbers as it's only arguments. The function will return the…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: Write a function that receives two parameters, the first one is a list and the other is a string.…
A: Programming Language used: Python Source code in Python (Note: all necessary comments are included…
Q: Write a function named find_mode () that takes a list as its only argument. Your function then…
A: The mode function is used to find the most frequently occurring values in a list. The below step…
Q: O Write a function that takes a list and 2 integers x and y as parameter an the following: • If the…
A: I have written python code below:
(python)
19. If the function has two lists (list1 and list2) and does the following for the return:
return [list1, list2]
What was returned from this function?
a. A new list with data of list1 and list2 combined
b. A new list with 2 elements: list1 and list2
c. A new tuple with the data of list1 and list2 combined
d. A new tuple with 2 elements: list1 and list2
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- -Python- Write a function get_letter_grade, such that when given * a lab grade score and * a list of the grade cutoffsreturns the letter grade of that score.Note: Your function automatically returns A for the values that are >= to the first cutoff-value in the list, then A- for the second cutoff-value, B+ for the third and so on. The function returns None for anything that's below the score for B-. You test that get_letter_grade(97, [93, 90, 87, 83, 80]) correctly returns an A, and get_letter_grade(93, [97, 90, 87, 83, 80]) returns A-. DO NOT hard-code the cutoffs, since they can change! You can copy/paste the following template: def get_letter_grade(score, cutoffs): if score ... : return 'A' ...: return 'A-' ...: return 'B+' ...: return 'B' ...: return 'B-'09. Python Write the in_order() function, which has a list of integers as a parameter, and returns True if the integers are sorted (in order from low to high) or False otherwise. The program outputs "In order" if the list is sorted, or "Not in order" if the list is not sorted. Ex: If the list passed to the in_order() function is [5, 6, 7, 8, 3], then the function returns False and the program outputs: Not in order Ex: If the list passed to the in_order() function is [5, 6, 7, 8, 10], then the function returns True and the program outputs: In order Note: Use a for loop. DO NOT use sorted() or sort()..NEED CODING IN PYTHON OR JAVASCRIPT BUT NOT C++ consider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is given by the user, ends with ‘#’. It should be stored in a table (or array), called TAMUK. The number of each of these letters is unknown. We have a function, called SWAP(TAM,i,j), which places the ith letter in the jth entry of string TAM and the jth letter in the ith entry of TAM. Note that SWAP(TAM,i,j) is defined for all integers i and j between 0 and length(TAM)–1, where length(TAM) is the number of letters of TAM. 1. Using our algorithmic language, write an algorithm, called Sort_TAM, which sorts the letters in the array TAMUK in a way that all T’s appear first, followed by all A’s, and followed by all M’s. The algorithm Sort_TAM should have one parameter: The array TAMUK. Also, your solution is correct only if the following four constraints are satisfied: - Constraint 1: Each letter (‘A’, ‘M’, or ‘T’) is evaluated only once. - Constraint 2: The…
- 8. using c++, Write a function method that determines the mean of all the values in an array of integers. Your mean function should call a separate function that you write that determines the sum. Don’t use built-in sum or mean gadgets, but roll your own.7. using c++, Write a void function that accepts an integer array a and a integer SizeA, and an integer n, and adds n to every element in that array. Be sure to develop an appropriate name for your function.What is wrong with the following C++ function? void Maximum(int a, int b, int& max) { if (a > b) max = a; else max = b; return max; }
- a- Write a Python function Salary_levels, that takes a list as an argument and returns the number of the high salaries (salary>=5000), the average salaries(1000<=salary<5000, and the low salaries (salary<1000). You can use the following list : salaries= [500,1070,1450,6500,9000,940,450,400,600,2750,1100,8400,1500,900,1200] b- Use the above function to print the counts of the high, average, and low salaries. N.B: the codes of parts a and b should be included in your answer.Use Clojure: a. The built-in function type is useful for checking what kind of object an expression evaluates to. Write a function both-same-type? that takes two arguments, and returns true when they both have the same type, and false otherwise. b. Write a function list-longer-than? which takes two arguments: an integer n, and a list lst and returns true if lst has more than n elements, and false otherwise. For example, (list-longer-than? 3 '(1 2 3)) should return false, and (list-longer-than? 2 '(1 2 3)) should return true.I need the answer quickly What is the meaning of the following declaration? int(*p[5])(); a) p is pointer to functionb) p is array of pointer to functionc) p is pointer to such function which return type is the arrayd) p is pointer to array of function
- For the following question, you are only allowed to use the following built-in functions: print(), range(), and len() write this code in python: Suppose you have the following animal names in a list: cat, dog,mouse, hamster. Write a code that prints the first letter, the last letter, andthe length of each animal’s name. Print out all the animal names that havea length greater than 3. and explain what you did6. using c++, Write a function that counts the number of times an integer t occurs in an array of integers.Problem Statement: Consider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is given by the user, ends with ‘#’. It should be stored in a table (or array), called TAMUK. The number of each of these letters is unknown. We have a function, called SWAP(TAM,i,j), which places the ith letter in the jth entry of string TAM and the jth letter in the ith entry of TAM. Note that SWAP(TAM,i,j) is defined for all integers i and j between 0 and length(TAM)–1, wherelength(TAM) is the number of letters of TAM. Using our algorithmic language, write an algorithm, called Sort_TAM, which sorts the letters in the array TAMUK in a way that all T’s appear first, followed by all A’s, and followed by all M’s. The algorithm Sort_TAM should have one parameter: The array TAMUK. Also, your solution is correct only if the following four constraints are satisfied: - Constraint 1: Each letter (‘A’, ‘M’, or ‘T’) is evaluated only once. - Constraint 2: The function SWAP(TAM,i,j) is used…