Write a function for solving a quadratic equation using the following header:def solveQuadratic(eqn, roots):The coefficients of a quadratic equation are passed to the list eqn and the noncomplex roots are stored in roots. The function returns the number of roots. See Programming Exercise 4.1 on how to solve a quadraticequation.Write a program that prompts the user to enter values for a, b, and c and displays the number of roots and all noncomplex roots.
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 a program that computes the Greatest Common Factor for any given two values. The user should…
A: #include <iostream> using namespace std; int GCF(int n, int m){ if(m<=n &&…
Q: print_smallest_and_largest_even Write a function named (numbers_list) that takes a list of numbers…
A: Finding smallest and largest Even number from list using python
Q: Algorithm Efficiency 1- Programming Problem Part 1 Write a function that will have a list as an…
A: the answer is given below:
Q: Write a function that returns the greatest common divisor (GCD) of integers in a list. Use the…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED PYTHON FOR THE SOLUTION. Define…
Q: Prompt the user to enter a string of their choosing (assume no punctuation). Store the text in a…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: In Pyhton IDLE, write a function that access two arguments: a list, and a number n. Assume that the…
A: Code Explanation : 1.Define function display_larger which accepts 2 parameters - List and integer n…
Q: n a program, write a function that access two arguments: a list, and a number n. Assume that the…
A: According to the Question below the Solution: Output:
Q: Write a function named mostCharacters that takes a list of strings as an argument and a character as…
A: we want a function that names"mostCharacters'" that take a list of strings as an argument and a…
Q: Using Common Lisp, complete the following programming exercises: Write a function that computes the…
A: As per bartleby guidelines we need to answer only first question if different questions are posted…
Q: Write the following function that returns true if the list is already sorted in increasing order:…
A: #include<iostream>using namespace std;bool isSorted(int arr[], int size){ for(int a=0;…
Q: Exercise #3 o Write a program averageLuminance(picture) which takes as input a picture uses…
A: Calculates image brightness by luminance per pixel. Extract each color components and calculate…
Q: In Programming Exercise 13 (Chapter 8), you are asked to write a program to calculate students’…
A: ANSWER:-
Q: Python programming. For this program, you need to write a function that processes a list, then…
A: Python Program def compound_interest(p, i, t): # Calculates compound interest Amount =…
Q: /** • PROBLEM 3: The following function draws miskey mouse, if you call it like * this from main: *…
A: the answer is given below:-
Q: Using JavaScript Define a function getMonth which accepts number from 1 to 12 as an argument and…
A: Java program to implement a function that returns the month name corresponding to the given number.
Q: Write a function called count_items() that takes a list and returns a dictionary that contains the…
A: here in code convert list to dict with an increment of repeat value.
Q: Use the Design Recipe to write a function num_negatives that consumes a list-type argument and…
A: Please find the answer below :
Q: primeFac (Perkovic, Problem 5.42) Write a function primeFac that computes the prime factorization of…
A: PROGRAM INTRODUCTION: Start the definition of the function to find the prime factors of the number…
Q: Create a function find zeros that will... find the zeros of a function. To do this search a 10 × 10…
A: A quadratic function's method: That equation is as follows for a linear transformation. y = f(x) = a…
Q: #in c++ We need to store information about each student in a class of N students. For example, name,…
A: PROGRAM EXPLANATION: The algorithm for creating the program with given description is as follows:…
Q: Write the following function that returns true if the list is already sorted either in an increasing…
A: C++ Code for above : #include <iostream> using namespace std; //function to check if the…
Q: 1. Create the functions sadness_score, and happiness_score 2. Each function has only 1 parameter of…
A: Step 1: Define function sadness_score(). Initialize list consisting of words and their weights.…
Q: Questions P1 and P2 are related to the following code segment. Below is the skeleton of a function…
A: def f1(n):#takes a list of integers for i in range(0,len(n)-2):#runs for i=0 to length of n-3…
Q: odular Programming: Your program should be modular and consists of the following functions: a)…
A: the code is an given below "
Q: 15- Write a function that takes two positive integers as a parameter .The first integer is the…
A: Provided below is the program which takes two positive integers from user for number of heads and…
Q: The two-dimensional lists m1 and m2 are strictly identical if their corresponding elements are…
A: Program Approach: Create a boolean function which takes two matrices.Using for loop check whether…
Q: Please right 2 different simple program;
A: The first question will be answered only. Here we divide the input number into digits existing at…
Q: Please answer it in python Write a ReadListInteger function without arguments that reads positive…
A: As all the questions are not related to each other. As per the rules of Bartleby I can only solve 1…
Q: Write a function named mostCharacters that takes a list of strings as an argument and a character as…
A: Program: Programs are used to provide the instructions to the system. It is used to solve complex…
Q: a) Write a c++ program which contains a function isPalindrome, the function checks a string using…
A: C++ programs to solve the given problems are given below.
Q: Write a recursive function that finds the number of occurrences of a specified character in a list.…
A: GIVEN: Write a recursive function that finds the number of occurrences of a specified character in a…
Q: 1. Write a program called a2_q1.py that asks the user (business owner) for their product information…
A: The problem should start by asking the business owner’s name (string) and the name of the company…
Q: Write a program to print the lyrics for ten verses of "The Ants Go Marching". A couple of sample…
A: Now, we have to create a lyrics() function that will take two arguments, first one is for number and…
Q: mplement a function void printAll(void) to print all the items of the list.
A: Here the pointer list is pointing to first node of listNode. The next node is accessed by using…
Q: Write a function that takes a list of numbers and returns the average of the values in the list.…
A: Function and main are define below with output.
Q: Write a recursive function named Multiply2 that multiples by 2 and prints each element in a given…
A: I have given answer in step2
Q: .Prime Numbers In this task, you will implement a program that takes as input a number n and…
A: Given, Pseudocode of isPrime() function: Step 1: count = 2Step 2: while count < numberStep 3: if…
Q: Write a function count_evens(nums) that takes a list of ints called nums and returns the number of…
A: NOTE - I have used python programing language to solve the question. Here I have defined the…
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: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a function…
A: Given: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a…
Q: program to be written in C Write a program that gets a list of integers from input, and outputs the…
A: It repeatedly swaps the adjacent elements if they are in the wrong order. First Pass: 5 1 4 2 8…
Q: Write a function Littlest3(values) that takes a list of numbers values and returns a list of the 3…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Create the function that takes a list of dictionaries and returns the sum of people's budgets.…
A: def getTotalBudget(people): cont = 0 for person in people: cont += person["budget"]…
Q: I need help Note: It`s a python Implement the following: 1) Define a function oddList() with an…
A: Solution: Given, 1) Define a function oddList() with an arbitrary parameter a.2) This function…
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: 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: Note: It`s a python Implement the following: 1) Write a function randFive() with one parameter n.…
A: 1) Below is program to implement randFive function that takes one parameter n and return five random…
Write a function for solving a quadratic equation using the following header:
def solveQuadratic(eqn, roots):
The coefficients of a quadratic equation are passed to the list eqn and the noncomplex roots are stored in roots. The function returns the number of roots. See
equation.
Write a program that prompts the user to enter values for a, b, and c and displays the number of roots and all noncomplex roots.
Step by step
Solved in 2 steps
- Assume that L is a list of Boolean values, True and False. Write a program in python with a function longestFalse(L) which returns a tuple (start, end) representing the start and end indices of the longest run of False values in L. If there is a tie, then return the first such run. For example, if L is False False True False False False False True True False False 0 1 2 3 4 5 6 7 8 9 10 then the function would return (3, 6), since the longest run of False is from 3 to 6.Prompt the user to enter a string of their choosing (assume no punctuation). Store the text in a string. Split the string into words and print out a sorted list of the words. Use a function print_words() to do this printing; it has a list of words as a parameter and prints each word on a a single line separated by spaces. When done printing the line, print a newline character. Now implement a convert_words() function, which has a list of words as a parameter, and returns a list of words all in lower case. Then extend your program to prompt the user as before, but this time also convert the words to lower case using convert_words(), sort them, and then print the list of lower case words again using print_words(). See the following Implement a remove_duplicates() function, which has a list of words that has been sorted as a parameter, and returns a list of words with duplicates removed. Then extend your program to print the sorted list of words all in lower case but without duplicate…Write a function that takes two arguments, a list L1 and a list L2. • If the length of the list L1 is greater than twice the length of the list L2, then append the first three values of L1 to the three last values of L2. E.g. if L1 = ‘(1 2 3 4 5 6 7) and L2 = ‘(8 9 10), then return ‘(1 2 3 8 9 10) Should be written in the Racket programming language
- Please answer it in Python Write a function somme_even that takes a list as an argument and returns the sum of the even numbers contained in the list. Example: somme_even([4, 7, 12, 0, 21, 5]) return => 16 (because 16=4+12+0). Write a function nb_elem_even that takes a list as an argument and returns the number of even integers contained in the list. Example: nb_elem_even([4, 7, 12, 0, 21, 5]) return => 3 (because 4, 12, and 0 are even). Write a function max_pair that takes a list as an argument and returns the largest even integer contained in the list. It will be assumed for simplicity (in this question only) that the list always contains at least one even number. Example: max_even([4, 7, 12, 0, 21, 5]) return => 12.program to be written in C Write a program that gets a list of integers from input, and outputs the integers in ascending order (lowest to highest). The first integer indicates how many numbers are in the list. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 10 4 39 12 2 the output is: 2 4 10 12 39 For coding simplicity, follow every output value by a space, including the last one. Your program must define and call the following function. When the SortArray function is complete, the array passed in as the parameter should be sorted.void SortArray(int sortingList[], int numValsIn c++, please. Thank you! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe 123-5432 Linda…
- Use Standard ML Code: Write a function that returns the factorial of a number. Write a function that sums all numbers in a list of pairs. e.g.: sum_of_pairs [(1, 2), (4, 3), (2, 5)] should return 17 (which is equal to 1 + 2 + 4 + 3 + 2 + 5) Write a function to return a list of second elements in a list of pairs. e.g.: sends [(1, 2), (4, 3), (2, 5)] should return [2, 3, 5]।Python programming. For this program, you need to write a function that processes a list, then tests the function with extreme values (min and max) Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f=p×(1+i)t• f is the future value of the account after the specified time period.• p is the present value of the account.• i is the monthly interest rate.• t is the number of months.Write a program that takes the account's present value, monthly interest rate, and the number of months that the money will be left in the account as three inputs from the user. The program should pass these values to a function that returns the future value of the account, after the specified number of months. The program should print the account's future value.PYTHON!!!! Complete the below function which takes a list of distinct positive integers and a target positive integer value, and then returns a list of the pairs of integers where each pair sums up to the target value. Each pair is represented as a tuple. For example, pairsum([3,2,6,1,5,4], 7) should return [(1,6), (2,5), (3,4)] If there are no pairs matching the target value, then you should return an empty list. IMPORTANT: the first integer in a tuple must be always smaller than the second integer. So, (5,3) is wrong and (3,5) is correct, and the resulting list must be in ascending order of first element in each tuple. """ def pairsum(list1, target):
- Questions P1 and P2 are related to the following code segment. Below is the skeleton of a function that takes a list of integers as an argument and returns True if the sequence [2, 3, 4] appears somewhere in the list. Fill in the blanks (denoted by [P1] and [P2]) with values that make the function operate correctly. def f1(n): for i in range(0,_______[P1]_______): if [1,2,3] == _______[P2]_______: return True return False The value of [P1] isEx1: a) Write a function for the user to enter a positive integer n with a value between 10 and 1000. If entered correctly, the function generates a list containing n random values that do not overlap between 1 and 5000 and the function returns the newly created list. Conversely, if entered incorrectly, the program will ask to re-enter until it is correct. Cases where n is considered incorrect:(i)- If the user enters a non-integer data type (like string, float, bool, ...)The program will display the error message 'Must enter a positive integer. Requires re-entry'.(ii)- If the input value is of the correct integer data type but the value is not in the range10 to 1000, the program gives the error 'Only values between 10 and 1000. Re-enter required'.Installation requirements: must use the try ... except statement to handle possible exceptionsin the program. b) Write a function that lists the amicable numbers in the list just created in a) (If there are no amicable numbers in the list,…python question Implement the following:1) Write a function dropLowest() with one parameter n.2) n is a list that contains any 5 random integers in the range (1,100) inclusive.3) The function should return the updated list which drops the lowest number in n.4) Call the function, dropLowest() with the argument n, n = [10, 44, 8, 78, 60].5) Print the result of the function call. 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 Output (n is the argument)[10, 44, 78, 60]