6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the list, and returns their sum. If the list of numbers contains fewer than five elements, raise a ValueError with whatever error message you like.
Q: insert_substrings_into_string(s, substrs): This function takes a string s and a string substrs. The…
A: Coded using Python 3.
Q: Task 5: Complete the following function: function CHECKCOLUMN (puzzle, j) end function This function…
A: Task 5 Made capacity MAKEVECTOR by passing contention column as vector Inside work : Make vector…
Q: count balance: uple[str, int], st[float]]], tuple[str, ht) -> float the balance of the account…
A:
Q: Program Three: Lists and Dictionaries Pizza3.py You need to copy Pizza2.py and make the following…
A: Inputs function to input the data from the user Processing function to process the orders Outputs…
Q: Complete the following program using functions. Dim num() As Integer = {2, 9, 3, 7, 12} Dim newnum()…
A: Here we are accepting an array from the user and then sorting the array in descending order using…
Q: C++ This is the given code: #include #include #include using namespace std; // The puzzle…
A: #include <iostream> #include <fstream> #include <vector> #include <ctime>…
Q: etween equally spaced X coordinates. Create a list of equally spaced X coordin. *a based on the…
A: I have written the PYTHON code below:
Q: Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or…
A: Step 1 : Start Step 2 : In the main function , Define a while loop which iterates till the user…
Q: • insert_substrings_into_string(s, substrs): This function takes a string s and a string substrs.…
A: def insert_substrings_into_string(s, substr): text = s strings = substr.split(", ") for i in…
Q: int val = a[3][4]; in this statement will take 4th element (column ) from the 3rd row of the array.…
A: An integer array element val is given int val = a[3][4]
Q: }; struct state { char name[20]; struct population pl; int district; float lit_rate; }; a. Write the…
A: “Since you have posted a question with multiple sub-parts, we will solve first three subparts for…
Q: 3. A list of numbers is considered increasing if each value after the first is greater than or equal…
A: Answer
Q: (python) prov_vac_status() takes a 2-D list (similar to the database) and an integer representing…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: strcmp is not working line 49 fix strcmp #include //including headers #include struct…
A: You forgot to include #include <string.h>
Q: This is a number that identifies an item in a list.a. elementb. indexc. bookmarkd. identifier
A: Index Index basically refers to the elements in the list through unique numbers incrementing…
Q: Q2. A. write a code to find the number of students who pass CS course, when their marks>=40 . As the…
A: Solution - code with output 1)
Q: o get the number of elements in the ______ we used sizeof (); function,
A: option (B) is correct option.
Q: Given variable cities = {'GA' : 'Atlanta', 'NY' : 'Albany', 'CA' : 'San Diego'} write statement to…
A: given: Given variable cities = {'GA' : 'Atlanta', 'NY' : 'Albany', 'CA' : 'San Diego'} write…
Q: PYTHON prov_records_per_date() takes a 2-D list (similar to the database) and an integer…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: Part B: Create letter combinations of that consist of elements of list1 and list2. For example: A,…
A: Objective: We need to design pseudocode to create two lists to store elements combining letters. Two…
Q: Briefly explain the difference between new operator and delete operator.
A: Dynamic Memory Allocation is used to avoid wastage of memory in programming
Q: The function below, get_value_if_key, takes two arguments: the dictionary data_dict and a key of any…
A: In Python, to access all the available keys in the dictionary, keys() method is used. It returns a…
Q: Given helper function: (Hint: This function is to be used to complete the docstring of the function…
A:
Q: please go in to the detail and explain in detail the purpose and function to each line & function of…
A: The given code first adds 1,2,3,2,2,4,1 in the link list by using the structure and then print the…
Q: Write a function frequency_match(text, chars) that receives a string text and a dictionary chars…
A: The required Python code: def frequency_match(text, chars): # function return list for word in…
Q: osts are Store onstant) lists: ITEMS = ["Beans", "Rice", "Banana", "Ice", "Tea", "Bread", "Orange",…
A: Code:…
Q: def report(filename): Write a function report(filename) that consumes a string file and returns the…
A: Given information, It is required to implement the report method that takes and reads a text file…
Q: Find Country Function Name: findCountry() Parameters: capitalList ( list) Returns: Dictionary…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: Here are the contents for a movie: Lab 27 Home Alone Jeff Nunn 1990 Here are the contents for a…
A: According to the question We have to write code for the following question: Sample code and output…
Q: Block elements are normally displayed without starting a new line. * False O True
A: answer is
Q: Make the Undo and Redo Functions void functions but keep them as they are.
A: So the thing is the code for undo redo and print are already completed sample output:- MyCommand…
Q: plete the following function according to its docstring using a while loop. The lists we test will…
A:
Q: Inserting Nodes into the List: In the following code (The Code is written By C) : there are 3…
A: Code :- #include<stdio.h> #include<stdlib.h> struct node { int data;…
Q: dify the sample code to prompt the user for a name. Have the program search the existing list for…
A: We need to define a function called search() that accepts a list and name ,search through the list…
Q: QUESTION 8 The isNaN() function verifies whether a value is an illegal number. True False QUESTION 9…
A: 8) isNaN() Function verifies whether a value is an illegal number 9) Moving a mouse over a element…
Q: Inserting Nodes into the List In the following code (This is Code By C) : there are 3 functions :…
A: void insert_last(){ //create a new node struct node *newNode = malloc(sizeof(struct node));…
Q: With number of array elements, a desired element will be searched in the string, and if it is found,…
A: With number of array elements, a desired element will be searched in the string, and if it is found,…
Q: 2. ID: A Name: 2. A list of numbers is considered increasing if each value after the first is…
A: List: List is used to store a collection of similar data types. List items is written in square…
Q: program7_1.py This assignment is about temperatures and requires the main function and a custom…
A: Below is the required program in python: Program Approach: Importing module random as we are…
Q: C. d. ne: ID: A 7. A summer camp offers a morning session and an afternoon session. The list…
A: Correct answer is option a
Q: { int row = 5, column ; while ( row -- > 0 ) { column = 4 ; if ( row % 2 == 0 ) cout 0) I" * " cout…
A: output along with an explanation is given below
Q: replaceNumbers function receives a list of integer numbers. The function replaces all even numbers…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Homework-3 Course Grade Application • Create 5 students. Ask these students from the user. • Each of…
A: code:- # to store the student information of 5 student li=[]# you can change the this marks…
Q: def recdif(lst): PRE: 1st is a list of 2 or more integers POST: returns the greatest absolute…
A: def recdif(lst): n = len(lst) if n <= 1: return 0 x = int(n/2) return…
Q: struct namerec{ char last[15]; char first[15]; char middle[15]; struct payrecord{ int id; struct…
A: Step 1 A struct is a user defined data type that contains variables of multiple data types. It is…
Q: Computer Science create function getRandom
A: SOLUTION IN BELOW STEP
Q: This assignment requires a dictionary of state abbreviations and their capital cities. The…
A: # create a dictionary with any four states myDict = {"AL": "Montgomery", "CA": "Sacramento",…
Q: Complete the display_coins_list(coins_list) function. This function takes a list (always nine…
A: Asked python program is given in the next step using for loop.
Q: A row vector is converted to a column vector using the transpose operator O True O False
A: true
Step by step
Solved in 2 steps with 1 images
- 6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the list, and returns their sum. If the list of numbers contains fewer than five elements, raise a ValueError with whatever error message you like. Sample calls should look like: >>> sum_highest_five([10, 10, 10, 10, 10, 5, -17, 2, 3.1])50>>> sum_highest_five([5])Traceback (most recent call last): File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode exec(code, self.locals) File "<pyshell#44>", line 1, in <module> File "/homework/final.py", line 102, in sum_highest_five raise ValueError("need at least 5 numbers")ValueError: need at least 5 numbersJS Write a function named count_in_range that takes a list/array of decimal numbers as a parameter. The function must return the number of entries in the parameter whose value is between 16.67 and 47.61. Your count should NOT include any entries whose value is equal to 16.67 or 47.61.JS Write a function named find_value that takes a list/array of whole numbers as a parameter. Your functio will need to find if the parameter contains the value 3 as an entry. Return true if the input has an entry equivalent to 3 and false if it does not.
- Write a function that returns the greatest common divisor (GCD) of integers in a list. Use the following function header:def gcd(numbers):Write a test program that prompts the user to enter five numbers, invokes the function to find the GCD of these numbers, and displays the GCD.- Zoc X Launch Meeting - Zoc X Is Everyone Really Eq X Reading Response 6 - X Ch7: Oppression & St X S Thank you for downlc X 5018/assignments/294537 3. find_movies_by_director This function takes a list of tuples (representing movies) and a string (representing a name of a director) and returns a list containing *only* those movie tuples where the movie director is equal to the requested director. Movie tuples are of the shape (title, year, director). You can use this list for testing purposes! [("Blade", 1998, "Stephen Norrington"), ("Underworld", 2003, "Len Wiseman"), ("The Lost Boys", 1987, "Joel Schumacher"), ("The Hunger", 1983, "Tony Scott")] %3D my_imovies Sample calls should look like this. >>> find_movies_by_director(my_movies, "Stephen Norrington") [('Blade', 1998, 'Stephen Norrington')] >>> find_movies_by_director(my_movies, "Sofia Coppola") []Tails Function Purpose: Produce a new column-based ( e.g. dict[str, list[str]] ) table with only the first N (a parameter) rows of data for each column. * Function name: Tails Parameters: 1. dict[str, list[str]] - a column-based table of data that_will not be mutated_ 2. int - The number of "rows" to include in the resulting list * Return type: dict[str, list[str]] Implementation strategy: 1. Establish an empty dictionary that will serve as the returned dictionary this function is building up. 2. Loop through each of the columns in the first row of the table given as a parameter. 1. Inside of the loop, establish an empty list to store each of the first N values in the column. 2. Loop through the first N items of the table's column, 1. Appending each item to the previously list established in step 2.1. 3. Assign the produced list of column values to the dictionary established in step 1. 3. Return the dictionary.
- Yahtzee! Yahtzee is a dice game that uses five die. There are multiple scoring abilities with the highest being a Yahtzee where all five die are the same. You will simulate rolling five die 777 times while looking for a yahtzee. Program Specifications : Create a list that holds the values of your five die. Populate the list with five random numbers between 1 & 6, the values on a die. Create a function to see if all five values in the list are the same and IF they are, print the phrase "You rolled ##### and its a Yahtzee!" (note: ##### will be replaced with the values in the list) Create a loop that completes the process 777 times, simulating you rolling the 5 die 777 times, checking for Yahtzee, and printing the statement above when a Yahtzee is rolled. When you complete the project please upload your .py file to the Project 2 folder by the due date.3. lookup_friends_heights This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You may want to use nested for-loops for this function. Sample calls should look like this. >>> lookup_friends_heights([{"name":"todd","height":170},{"name": "sarah", "height":165},{"name":"dweezil", "height":175}], ["dweezil", "sarah"]) [175, 165] >>> lookup_friends_heights([{"name": "todd","height":170},{"name": "sarah","height":165},{"name": "dweezil", "height":175}], %3D ["sarah", "elíza", "dweezil"]) [165, None, 175]3. lookup_friends_heights This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You may want to use nested for-loops for this function. Sample calls should look like this. >>> lookup_friends_heights([{"name":"todd","height":170},{"name": "sarah","height":165},{"name":"dweezil","height":175}], ["dweezil", "sarah"]) [175, 165] >>> lookup_friends_heights([{"name": "todd","height":170},{"name": "sarah","height":165},{"name": "dweezil", "height":175}], ["sarah", "elíza", "dweezil"]) [165, None, 175]
- 3. lookup_friends_heights This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You may want to use nested for-loops for this function. Sample calls should look like this. >>» lookup_friends_heights([{"name":"todd", "height":170},{"name":"sarah","height":165}, {"name":"dweezil","height":175}], ["dweezil", "sarah"]) [175, 165] >>> lookup_friends_heightsC[{"name":"todd","height":170},{"name":"sarah","height":165}, {"name":"dweezil","height":175}], ["sarah", "eliza", "dweezil"]) [165, None, 175] 4. class definition for Friend For the next version of the friends database (coming soon!), we want to use classes rather than dictionaries. Define a Friend class , where each Friend object…Brussel's choice def brussels_choice_step(n, mink, maxk): This problem is adapted from another jovial video "The Brussel's Choice" of Numberphile (a site so British that you just know there has to be a Trevor and a Colin somewhere in there) whose first five minutes you should watch to get an idea of what is going on. This function should compute and return the list of all numbers that the positive integer n can be converted to by treating it as a string and replacing some substring m of its digits with the new substring of either 2*m or m/2, the latter substitution allowed only when m is even so that dividing it by two produces an integer. This function should return the list of numbers that can be produced from n in a single step. To keep the results more manageable, we also impose an additional constraint that the number of digits in the chosen substring m must be between mink and maxk, inclusive. The returned list must contain the numbers in ascending sorted order.O Launch Meeting Zoom 9 Is Everyone Really Equal? X Reading Response 6 - Goog X E Ch7: Oppression & Sexism 6 Thank you for downloading x du/courses/46018/assignments/294537 docstring explaining what it does! 1. count_perfect_squares This function takes a single argument, nums , which is a list of numbers. The function counts up how many of the numbers in the input list are "perfect squares", which is to say that they are a square of an integer. Sample calls should look like this: >>> count_perfect_squares ([2, 3, 4, 16, 100, 5, 1]) 4 >>> count_perfect_squares([]) >>> count_perfect_squares([13])