Create a function `count_foreignlang` that will read ` a json file and return a list of tuples where the first element is a `foreignData` `language` and the second element is the number of times that `language` is found in a `foreignData`. Return only the 10 most frequent `language` sorted by decreasing number of occurrences.
Q: Write a python function, this function reads an external txt file (.txt) and assigns it to a string…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Write a function named `freq(l)` that takes a list `l` of numbers and returns a tuple of the most…
A: Here is the python3 code implementation of above problem. For input1:…
Q: 5. Write a function func3 (n) that takes as an input a positiv dictionary where the keys are the…
A: SUMMARY⦁ A Python dictionary is a collection of key value pairs where each key has a value…
Q: Write a function named slice_it (numbers_list, index) that takes a list and an integer as…
A: - We have to code the slice function.
Q: the function has two lists (list1 and list2) and does the following for the return: return…
A: Given : 19. If the function has two lists (list1 and list2) and does the following for the return:…
Q: Write a function that takes two arguments: stock and ingr (short for ingredients) and returns the…
A: stock = {"salt":100,"sugar":100,"flour": 50,"apple":3,"cream":10}ingr =…
Q: Write a Pyihon function called add_daily_temp that is given a (possib!y empty) dictionary meant to…
A: Introduction
Q: Q1:Given the following linked list : Write a function to do each of the following ,then test the…
A: The solution for the above given question is given below:
Q: Write a function create_list_MtoN that will create and return a list of integers from m to n (where…
A: def create_list_Mton(m,n): lis=[] if(m>n): # for m is greater than n for…
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: Create a function that takes in a sentence as input and returns true if there is at least one…
A: Program Plan: Since there is no specific language mentioned, the following code is written in Python…
Q: Define a function called create_numbers_dictionary (numbers) which takes a list of integers as a…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Write a Python function that implements bubble sort. It should take a list of numbers and order the…
A: Hey! I am implementing the algorithm in jupyter notebook on a linux machine with the easiest…
Q: Write a function get key that takes as input a dictionary with integers as values, and a function.…
A: Given:
Q: Given the following function foo , which choice(s) best describes its functionality in general?…
A: Answer : foo returns a new list of elements containing only even integers foo mutates list lst,…
Q: Write a Python function that implements selection sort. It should take a list of numbers and order…
A: The program is implemented in Jupyter Notebook on Linux Environment with all headings and comments…
Q: We have to write Code in C language with the help of Linked list That perform following tasks .…
A: For storing the data of the employee, create a user-defined datatype that will store the…
Q: Write a function named count(...) that receives as an argument a nested list of integers Each cell…
A: The number of 9's will be checked in the same position at above and below rows and adjacent two…
Q: Given the following function foo , which choice(s) best describes its functionality in general?…
A: The given function foo() is taking a list of integers as argument. Inside the function, the code is…
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: Write a function named create_names_dictionary (initials_list, names_list) which takes a list of…
A: Here I have defined the function named create_names_dictionary(). Next, I have used a loop to…
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: in python write a function where it makes a dictionary from given text file. If no value is present…
A: SUMMARY: - Hence, we discussed all the points.
Q: Write the function selection_sort_descend_trace() that takes an integer list and sorts the list into…
A: In the given code, we need to implement the concept of selection sort. This sorting algorithm is…
Q: In the cell below, there is a function that is not operating as anticipated. count_consonants is…
A: def Check_Vow(string): # casefold has been used to ignore cases string = string.casefold()…
Q: Write a function called selector wh returns A; even integers between symmetric lists (one whose…
A: SOLUTION:: 1. # selector functiondef selector(number): # one whose reverse is equal to itself…
Q: piggуваnk Write a function piggyBank that accepts a sequence of "coins" and returns counts of the…
A: Given The answer is given below. Step1:- def piggybank(coins): sum = 0 total =…
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 min2 to compute the second smallest of number of an integer list. You may assume…
A: According to the Bartleby guidelines, we can answer only one question. These are different questions…
Q: Write a Python function that implements insertion sort. It should take a list of numbers and order…
A: Programming instructions: Declare and initialize an array. Call the insertion sort function. Open…
Q: Write a function named dictMax which takes two arguments: a dictionary and a list. Your function…
A: Initialize the return value to None and in the initial value we simply update None with our…
Q: Q1: Given the following linked list : Write a function to do each of the following ,then test the…
A:
Q: #include using namespace std; // Function to return a vector that contains // all the generated…
A: It is defined as direct descendant of C programming language with additional features such as type…
Q: Write a function report(filename) that consumes a string file and returns the grades of each student…
A: class Coursegrade: ''' Fields: grade(Str) course(Str) Requires: grade in ['4', '5', '6', '7',…
Q: • Create a function which takes a tuple and returns a dictionary which is a histogram to count how…
A: I solve the question give the code along with screenshot of output along with histogram.
Q: Write a function get_key that takes as input a dictionary with integers as values, and a function.…
A: Python get() method return the value for the given key if present in the dictionary. If not then it…
Q: Write a Pyihon function called add_daily_temp that is given a (possib!y empty) dictionary meant to…
A: Explanation 1) Below is program that defines a function add_daily_temp which accept a dictionary…
Q: Write a function myreversed (items) to return a list containing the items in items in reverse order,…
A: logic:- within function definition, define an empty list lst=[] iterate from i=len(items)-1…
Q: IS Write a function named number_of_pairs whose parameter is an object/dictionary with strings as…
A: ALGORITHM:- 1. Declare and initialise a dictionary. 2. Pass this dictionary to the function which…
Q: Python. Write a function letter_count(L) that takes a list of strings and returns a dictionary D…
A: D = dict() declare empty dictionary for string in L: for loop for traversing each string of…
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: 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: Write a program to test the function binarySearch. Use either the function bubbleSort or…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: Write a function called list_to_dict(lst) that takes a 2-D list of sales records of this form.…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: Consider the following function: int enigma(NodeInt32* node) { if(node == NULL) return 0; else…
A: The given Function is int enigma(NodeInt32* node){if(node == NULL)return 0; elsereturn 1 +…
Q: Write a function removeN which takes three arguments called N, E and L (where L is a list) and…
A: Find the code attached. package com.company;import java.util.*;public class Main { public static…
Q: Define a function named get_encrypted_list (word) which takes a word as a parameter. The function…
A: As per the requirement program is developed. Note : In the question programming language is not…
Q: Please answer it in Python Write a function show_plateau that takes as an argument a dictionary…
A: Code: def show_plateau(dlings): s="" #Iterating through dictionary for key,value in…
Q: We have to write Code in C language with the help of Linked list That perform following tasks .…
A: The code is below:
Q: Write a function named freq(1) that takes a list `1 of numbers and returns a tuple of the most…
A: res=freq([1,2,3,1,2,1,2,3,1,2]) Output:([1,2], 4)
Step by step
Solved in 2 steps
- Write the code for the following function."""def unmask_chars(s1: str, s2: str, mask: str) -> str:'''Return a new string where the character at index i iss1[i] if mask[i] is 0and s2[i] if mask[i] is 1.len(s1), len(s2), and len(mask) are equal.>>> unmask_chars('cat', 'bat', '001')'cat'>>> unmask_chars('a', 'b', '0')'a'>>> unmask_chars('apple', 'graph', '01011')'arpph''''# TODO: Write your code hereWrite a function that takes in a list of integers L and an integar n. The function returns the absolute value of the sum of the every other nth element of L. Make sure not to use an index outside the possible locations within L.Write a function Delete(x,L) in Pascal that deletes last occurrence of x in a singly linked list and returns the number of elements (not the elements*) before the deleted element x. MANDATORY FOR CODE TO BE IN PASCAL.
- Write a python function, this function reads an external txt file (.txt) and assigns it to a string variable (str). it then parses the whole character into words through this variable (split), all words are shown in lower case (lower). All word groups that do not contain alphabetic characters in the parsed words are removed from the list. Repeating words should also be removed from the list. The function returns a list of the words in the file as the return value.JUST ONLY USE <iostream>. Write a program that reads 10 pairs of Cartesian coordinates from a file called "points.txt" and sorts them by increasing x-values, decreasing y-values, and increasing distance from the origin. Use only one sorting routine. Use an enumerated data type to keep track of the field on which the list is being sorted. The number of pairs should be in a global constant c++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.75
- Creation of a python function named b_length that bins a list of strings into a dictionary where the key is an int length of a given string and the associated values are a set of strings of the key’s length found in the original list. How it should work correctly in a test: assert b_length(["your", "quick", "code"]) == {3: {"your", "code"}, 5: {"quick"}} assert b_length(["the", "the", "code"]) == {3: {"the", "code"}}Please provide code in the form of SML language, read directions carefully One file will have the two functions in it, the other file will be a test file with calls to the functions to test that they work. Thank you for any help you can provide. Write a union function that takes two lists that are in order from smallest to largest and produces a list with a single copy of all elements from both lists. The resulting list must also be in order from smallest to largest. Write an intersection function much like union, but with the result containing only those elements that appear in both lists. All lists will be in order from smallest to largest.This problem needs to be solved in python. Write a function read_movies_data(f) that takes in a movies file and returns a pandas DataFrame, where the index is the movie id and the columns are "title", "year", and "genre" (in that order). movies_df = read_movies_data("moviesSample.txt") assert movies_df.shape == (9, 3)assert movies_df.iloc[2, 2] == "Comedy"assert movies_df.loc[6, "title"] == "Heat"assert all(movies_df.columns == ["title", "year", "genre"])assert list(movies_df.index) == [1, 2, 3, 4, 5, 6, 8, 9, 10] NOTE: Make sure all of the asserts work The moviesSample.txt looks like this: 1|Toy Story|1995|Adventure2|Jumanji|1995|Adventure8|Tom and Huck|1995|Adventure3|Grumpier Old Men|1995|Comedy4|Waiting to Exhale|1995|Comedy5|Father of the Bride Part II|1995|Comedy6|Heat|1995|Action9|Sudden Death|1995|Action10|GoldenEye|1995|Action NOTE: Try to sent screenshots of the code working.
- Write a function that gets a linked list of ints, and reverses it. For example - on input 1 -> 2 -> 3 -> 4, after the function finishes the execution, the list becomes 4 -> 3 -> 2 -> 1 - If the list has one element, then it doesn’t change - If the list is empty, then it doesn’t change You may use the data fields in the struct and the functions provided in LL.h and LL.c. // reverses a linked list void LL_reverse(LL_t* list); Test for the Function: void test_q3() { LL_t* lst = LLcreate(); LL_add_to_tail(lst, 1); LL_add_to_tail(lst, 3); LL_add_to_tail(lst, 8); LL_add_to_tail(lst, 4); LL_add_to_tail(lst, 3); LL_reverse(lst); intcorrect[] = {3,4,8,3,1}; inti; node_t* n = lst->head; for(i=0;i<5;i++) { if (n==NULL) { printf("Q3 ERROR: node %d==NULL unexpected\n", i); return; } if (n->data != correct[i]) { printf("Q3 ERROR: node%d->data==%d, expected %d\n", i, n->data, correct[i]); return; } n = n->next; } if (n==NULL) printf("Q3 ok\n"); } Support…Write a function that gets a linked list of ints, and reverses it. For example - on input 1 -> 2 -> 3 -> 4, after the function finishes the execution, the list becomes 4 -> 3 -> 2 -> 1 - If the list has one element, then it doesn’t change - If the list is empty, then it doesn’t change You may use the data fields in the struct and the functions provided in LL.h and LL.c. // reverses a linked list void LL_reverse(LL_t* list); Test for the Function; void test_q3() { LL_t* lst = LLcreate(); LL_add_to_tail(lst, 1); LL_add_to_tail(lst, 3); LL_add_to_tail(lst, 8); LL_add_to_tail(lst, 4); LL_add_to_tail(lst, 3); LL_reverse(lst); intcorrect[] = {3,4,8,3,1}; inti; node_t* n = lst->head; for(i=0;i<5;i++) { if (n==NULL) { printf("Q3 ERROR: node %d==NULL unexpected\n", i); return; } if (n->data != correct[i]) { printf("Q3 ERROR: node%d->data==%d, expected %d\n", i, n->data, correct[i]); return; } n = n->next; } if (n==NULL) printf("Q3 ok\n"); } Support File…Write a Python function countEvens that consumes an integer N and a nested list representing a matrix of arbitrary size (but larger than NxN). The function returns the number of even numbers in the NxN sub-matrix of the first N rows and columns. Note: You may assume the list argument passed to the function is a nested list of integers, but it may be larger than NxN!