Create a function in Python named rare (s) which takes as parameter a integer s, and which returns a list. Respect the type contract (int) -> list If the parameter s is strictly positive (n> zero), then the function returns the list of all positive and odd divisors of s. If s is negative or zero, then the function returns an empty list.
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: Write a function find_plateaus that receives a list of integers as parameters. Your function should…
A: A Python program is as follows, File name: “main.py” #Define a function that find and return a list…
Q: Write a function print_less() which • takes an integer, x and a list on integers, a list as…
A: Iterate over given a_list and then check each number in the list whether it is lesser than x or not…
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: Write a function interleave that takes two lists 1st1 and 1st2 of the same length and that returns a…
A: Solution Program def my_fun(x,y): res = lst1 + lst2 res[::2] = lst1 res[1::2] = lst2…
Q: Please write a PYTHON function program that takes a list of integers and returns the same list, but…
A: We are going to create a Python code which will remove duplicates from the list passed to a function…
Q: Write a function that does the following: 1. Its name is flatten. 2. It will take one parameter,…
A: ALGORIHTM / STEPS: Create a new list for storing the elments of numbers list Traverse through…
Q: Write a function split n l that splits the list l and returns a pair of lists containing the first n…
A: def split(l,n): li=l[:n] lii=l[n:] liii=(li,lii) return…
Q: Write a python function named replaceVal(list, valToBeReplaced, newValue) which takes the above…
A: Have to program a function replaceVal which can replace the values form a list which is mentioned in…
Q: Write a function (Ocaml) that takes an ’a list and an int list of values and returns second list,…
A: In Ocaml, an expression is a function. Thus, a value representing a function is called a function.…
Q: Please answer it in Python Write a function insere_milieu that takes as an argument a list l and an…
A: The asked python program is coded in the next step and is explained within comments in the program.…
Q: Write a python program as function that displays a list Prog and returns a tuple of two list…
A: Algorithm: Create function(Prog) Display list prog for i in range(len(Prog)) if %2==0…
Q: Write a program which reads from a user, a list of positive integers that ends with a sentinel -1.…
A: The ask is to write a program which reads a list of positive integers ending with a sentinel value…
Q: Define a function below called make_list_from_args, which takes three numerical arguments. Complete…
A: Note:- You have not mention the language of the program, So I am doing your question in Python. Your…
Q: Write a function that takes a list as a parameter. The list will contain a mixture of integers and…
A: Rawcode: #asking user to enter list elements elements = input("Enter the list elements: ")…
Q: Write a program in Python including the following function: Write a function which takes a list of…
A: Steps to be followed: STEP1: Declare a function named form that accepts a list of integers and an…
Q: Generate equally spaced coordinates We wish to generate n + 1 equally-spaced z coordinates in [a,…
A: """Python program to create linspace function and test its generated list""" #linspace function…
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: Given the following incomplete Python function find positive_value_coordinates, fill in the blanks…
A: Note : Here Not Provided Options. So i Will make my Own Variables. just variable name are different…
Q: In Python Please Implement a function all_same(lst: list) -> bool that determines whether all the…
A: Code1: (using manual method) Code2: (using all() function)
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: Please answer it in Python Write a function integerlist that would return Increasing, Decreasing,…
A: Your python program is given below as you required with an output.
Q: rite a python function called rem_duplicate that takes a tuple in the parameter and return a tuple…
A: Define function rem_duplicate with parameter as tup. Define empty array temp_tup. Use for condition…
Q: Write a function sumLength() that takes a list of strings as parameter, finds and returns the total…
A: Write a function sumLength() that takes a list of strings as parameter, finds and returns the total…
Q: Please answer it in Python Write a function convertir_liste that takes as an argument a list of…
A: Python Program: # Given list of stringsstringList = ['1', '12.3', '4.12'] # Display the given…
Q: create a Python function, called number(Lollntegers), which takes as parameter a list made up of…
A: Program: def number(LollIntegers): # called function recieve the list of integers from calling…
Q: Write a program that takes a list of S integers and performs the following functions. Create two…
A: 1) Below is program that takes a list of S integers and performs delete prime and reverse list…
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: In Python: Write a function that takes in two lists (A and B) as parameters, and an integer (sum).…
A: Given data, Write a function that takes in two lists (A and B) as parameters, and an integer (sum).…
Q: Write a function that accepts a number and a string as arguments. It should return a list having n…
A: We need to write a function that accepts two parameters- a number a string The function will…
Q: write a Python function that takes in a list of integers (nums) and finds whether the list consists…
A: Write a python code which has a function that takes a list of numbers and returns false if it does…
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: Please answer it in Python Write a function min_pair that takes a list as an argument and returns…
A: '''logic to solve this problem:first extract all even numbers to a new list :Nthen traverse each…
Q: Implement a function countMultiples in Python that: accepts a single argument, a 2-dimensional list…
A: 1)Declare count=0 2)Iterate through each list in list of list using for loop 3)next iterate…
Q: Write a function named `vectorSum(11, 12) that takes two lists of numbers and adds the numbers in l2…
A:
Q: Write a program in python that reads a list of integers, and outputs whether the list contains all…
A: PROGRAM: #Function definition def is_list_even(my_list): #Iterating list elements for x in…
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 sum67 that takes a list as an input parameter and returns the sum of the numbers in…
A: Below is the code in python and sample output:
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: 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 python function called remove_odd that takes a list of numbers that have both even and odd…
A: PROGRAM CODE: def remove_odd(list): list = [x for x in list if x%2==0] print (list)…
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: Given the following incomplete Python function find_positive_value_coordinates , fill in the blanks…
A: Since the values in the dropdown list is not given, I am filling the blanks as per requirement.…
Q: Write a function cont_frac (1) that accepts a non-empty list 1, and returns the value of the…
A: Program Explanation: Take user input for value of a Calculate the initial values of a and r and…
Q: should be in python: write a function that receives a list as its only parameter. Inside the…
A: 1. Create a list 2. Making a function remove_duplicates_list(duplist) to remove the duplicate…
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…
please use your own code and just a picture
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- Write a Python function peaksIndex() that takes a list as parameter, returns a list that contains the indexes of peak values in the list.A peak value is greater than its predecessor and its successor.Assume that the list contains numbers.Example: [4, 2, 5, 7, 6, 6, 4, 3, 5, 2, 6, 7] has 2 peaks, the first 7 (index 3) and the second 5 (index 8). Both of these values are greater than their predecessor and their successor. So the function will return [3, 8] for this list.Write only the answer of what is asked.Write a function countBottom() that takes a list as parameter, finds and returns the number of bottom values in the list.A bottom value is less than its predecessor and its successor.Assume that the list contains numbers.Example: [4, 2, 3, 7, 6, 6, 4, 3, 5, 8, 6, 7, 5] has 3 bottoms, the first 2, the second 3, and last 6. All these values are less than their predecessor and their successor. can u use pyhton and pls fast answer=)Write a function getMultiples() that takes a list of integer numbers and an integer number as parameters, returns a new list made of the numbers in the list that are multiples of the number in the second parameter.Example: If the parameters are [44, 80, 72, 245, 7, 24] and 5, then the function will return [80, 245] which are multiples of 5 (or divisible by 5).The function must work for all integer lists and all 2nd integer parameters. pls pyhton and answer fast thank u
- Please answer it in Python Write a function insere_milieu that takes as an argument a list l and an element elem and returns the list obtained from l by adding elem "in the middle" of l, that is: If the length of l is even, the item is added once, in the middle of the list. If the length of l is odd: the element is added on either side of the central element. Example: insere_milieu([4, 7, 12, 3], 0) is [4, 7, 0, 12,3] insere_milieu([9, 3, 5, 6, 2], 1) is [9, 3, 1, 5, 1, 6, 2].Write a function getOdds() that takes a list of integer numbers as parameter, returns a new list made of only the odd numbers in the list.Example: If the parameter list contains [44, 81, 7, 24], the function will return [81, 7].Please answer it in Python Write a function min_odd that takes a list as an argument and returns the smallest even integer contained in the list. If the list contains no even integers, the function will return None. For Example : min_odd([45, 62, 19, 22, 26, 18, 3, 5, 14])Expected answer is 14 min_odd([])Expected answer is None Write a function index_of that takes as an argument an integer (supposedly even) and a list, and returns the index to which this integer appears in the list. If the integer does not appear, the function will return None. It is assumed here for simplicity that the integer searched for does not appear several times in the list. Hint: if the for e in list loop doesn't suit you, remember that you can make a for + range or a while. .. For Example: index_of(34, [3, 67, 62, 34, 19, 24])Expected answer is 3 index_of(16, [2, 6, 104, 5, 25, 18, 50, 16])Expected answer is 7
- Write a program in python with a function isPal(L), where L is a list of integers, and the function returns True if the list is a palindrome, False otherwise. For example [5, 2, 9, 9, 2 5] is a palindrome. Use the reverse() method of list and check if the reversed list is the same as the original list.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.Write a function called `filler(A, l)` that takes an integer `A`, and a list of integers `l` and if some of the numbers in `l` sum up to `A` then it returns a list of these numbers. Otherwise, it returns `None`. For example, filler(5, [1,6,3,4]) returns [1,4]. filler(5, [1,6,3,7]) returns None. filler(0, [-1,-1,2,-3]) returns [-1,-1,2]. filler(10, [2,3,2,3,1]) returns [2,3,2,3]. If there are multiple answers, then return any of them. You can use each number in the list once for each occurence. """ def filler(A, l): # remove the following line to solve this question return
- 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(a) Write a function top_students(marks) that takes as a parameter a non-empty list of (name, mark) tuples, where name is the name of a student (a string) and mark is the student's mark for some course (an int). The function returns a list of the names of all students whose mark equals that of the top student. If there is just a single student with the maximum mark, the return value will be a list of length 1, as in the first example in the table below. The names in the return list should be in the same order as in the input parameter list. Test Result marks = [('Beatrice', 50), ('Nerly', 90), ('Uniza', 70)] print(top_students(marks)) ['Nerly'] marks = [('Beatrice', 80), ('Nerly', 75), ('Uniza', 66), ('Joshua', 80)] print(top_students(marks)) ['Beatrice', 'Joshua'] (b) Write a function char_counts(string) that takes a string as a parameter and returns a dictionary in…PYTHON!!! Implement a function insert_sorted, which will insert a string into its appropriate location in a list of sorted strings. This function is called with two parameters: - A list containing words (each of type str) appearing in an ascending lexicographical (alphabetical) order. - A word (of type str) that is to be inserted into the list provided by the first parameter. When the function is called, it should add the second parameter's value into its sorted place in first parameter (the list). That is, it mutates the list, so that after the execution, it would also include the newly added word (the second parameter), and remain sorted.