After executing the following code segment the value stored in the variable "x" will be_ int List[100]; int x = 0; for (int i=l; i<100; i++) { if(List[i] %2==1 && List[i]
Q: currnetMin currnetMinlndex The list
A: Here we drive and run the code in figure then fill the table.…
Q: Python programming question: I have a 2d list [[1134],[2221],[3321],[2324]]. It is outputted as…
A: In the solution of given problem, we input row number and column number of element as a replacing…
Q: Write a function randomList() that gets three integers as parameters, start, bound and k. This…
A: Python program to generate the k random integer numbers. Find the square root of all the k numbers.…
Q: Two arrays list1 and list2 are strictly identical if they have the same length and list1[i] is equal…
A: Program: // C++ version 14 # include <iostream>using namespace std;// boolean functionbool…
Q: 1. Write a game of rock paper scissors, one of the choices will be from the user and the other from…
A: import random while True: user_action = input("Enter a choice (rock, paper, scissors): ")…
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: 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: You can shuffle a list using random.shuffle(lst). Write your own function without using…
A: PROGRAM CODE: import random // import the random library def shuffle(lst):…
Q: 1. Write a program that has a loop to read in ten strings and put them into a list. Write a second…
A: Use a for loop to iterate from 0 to 9 in first loop and 9 to 0 in another loop
Q: Exercise 4: Write a program that reads n student's test scores in the range 0-100 from an input…
A: Python code for the given problem :- Note :- Indention might be lost in the code while pasting it…
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: This assignment is about temperatures and requires the main function and a custom value-returning…
A: A required program is as follows, import random '''Define a function that returns a smallest list of…
Q: 1)Write a game of rock paper scissors, one of the choices will be from the user and the other from…
A: 1. Basically there are 3 possible input Stone Paper scissors So this is the concept of first…
Q: This built-in function returns the highest value in a list. a. minimumOf() b. minimum() c. min() d.…
A: min() is used to return the lowest element in the list. Also highest value cannot be associated…
Q: Exercise 4: Write a program that reads n student’s test scores in the range 0-100 from an input…
A: Python code for the given problem :- Note :- (Indention might be lost after i copy the code here,…
Q: 2. listAverage() returns the average number in a list. Which of these functions does this correctly?…
A: listaverage() function which return the average of number given in list.
Q: quence of adjacent repeated values. Write a Python script to generate a sequence ofT 20 random die…
A: Python code :- import random def run():#create a list of 20 random number in range (1,6)List = []for…
Q: If I double the number of items in a sorted list of numbers, all algorithms will take twice as long…
A: Answer for all given below with explanation
Q: In python, Problem Description: You are hosting a party and do not have room to invite all of your…
A: Given: In python, Problem Description:You are hosting a party and do not have room to invite all of…
Q: int foo(listL,int s) if (L.empty() ) return 0; if(s<L.size () ) { int t; L.retrieve (s,t); return…
A: Question: This code used to?
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: Question 3: Contains N Write a function that takes in a list and a number, and returns whether or…
A: for searching a value in list use the in operator, which will return the Boolean value True, if the…
Q: Test the program using the following procedure (Use Linked List): Call PUSH(5) Call PUSH(2) Call…
A: Required:
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: Create a Flowchart for this code. #Declaring and initializing the list cars =…
A:
Q: a) Write a program containing a for loop that sums the values from the LIST_SIZE element array list.…
A: The program containing a for loop that sums the values from the LIST_SIZE element array list is…
Q: Complete the calc_average() function that has an integer list parameter and returns the average…
A: def calc_average(nums): return sum(nums) / len(nums) Step1 : create a python program with…
Q: Using the mapped list pattern, write a function cubes (data) that returns a list of the cubes of all…
A: Given:
Q: This program in python that requires two functions. In the main function: create an empty list. use…
A: Program Instructions:Import random module and use randint() function to generate random numbers.Use…
Q: Using Python: This assignment requires the main function and a custom value-returning function. The…
A: Python program to solve the given problem
Q: In Python use the Design Recipe to write a function, count_odds, that consumes a list and two…
A: Program Instructions:Write the function header and type contrast of the program.Write description…
Q: Write an application that accepts up to 20 Strings, or fewer if the user enters a terminating…
A: while (str.equals(sentinel) != true && count < 20) { if (str.length() <= 10) {…
Q: listAverage() returns the average number in a list. Which of these functions does this corre O A.…
A: It is define as set of statements that take inputs, do some specific computation and produces…
Q: Write the following function that tests whether the list has four consecutive numbers with the same…
A: #declarer functiondef isConsecutiveFour(values): #return the values return sorted(values) ==…
Q: Use this code to get the number of operations from a list size of 10, 30, 50, 70, 100. In C++ bool…
A: Introduction: To sort an array of N numbers using bubble sort, we need to compare two adjacent…
Q: Exercise 4: Write a program that reads n student's test scores in the range 0-100 from an input…
A: def readData(): # the user define function to…
Q: s of repeated faces. Note the following examples: Suppose the following numbers were provided in the…
A: hi,
Q: In a program, write a function that accepts two arguments: a list, and a number n. Assume that the…
A: Since programming language not mentioned using python.
Q: Using python, please explain 1: A positive integer greater than 1 is said to be prime if it has no…
A: The python program to solve the above problem is given in the steps below.
Q: Write the following function that returns the location of the largest element in a two-dimensional…
A: According to the Question below the Solution: Output:
Q: For this project you will create a program that populates a list of 8 car manufacturers. You can…
A: SOLUTION-I have solve the problem in python code with comments and screenshot for easy…
Q: def average_daily_temp(high_temps: list[int], low_temps: list[int]) -> list[float]: """high_temps…
A: According to the Question below the Solution: Output:
Q: Exercise 4: Write a program that reads n student's test scores in the range 0-100 from an input…
A: The python code is given below:
Q: from an input Exercise 4: Write a program that reads n student's test scores in the range screen and…
A: def countFrequencey(numList, num): count=0 for i in range(len(numList)): if…
Q: The first parameter represents an inner list index and the second parameter represents converted…
A: In the code here we have defined some constant integers that will be used as index to find the sum…
Q: fter executing the following code segment the value stored in the variable "x int List[100]; int x =…
A: Given Code: To find: Value in X
Q: Ask the user to input how many numbers to store in a list. Input the numbers as defined in Step 1.…
A: n = int(input("How many numbers to store in a list? ")) print("Enter", n, "numbers:")lst = [] for i…
Q: that gets a a paramet ate from that list. At the end return the new list. Do not use dictionary…
A: Main logic: - i = 0 while i < len(a): j = i + 1 while j < len(a): if…
Q: (Using Python)Write a function that returns a new list by eliminating the duplicate values in the…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
C++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Ex1: 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,…#include <stdio.h>#include <string.h>#define SIZE 6struct Student{char name[50];int id;float mark;};int Search1(char input[], struct Student data[]);int Search2(int input, struct Student data[]);int main() {char search_name[30];int search_id;int result1, result2;struct Student list[SIZE] = {{"Amylia", 544199, 75.4},{"Cheong", 143566, 92.3},{"Harry", 109774, 65.5},{"Krishnan", 334514, 86.7},{"Melissa", 257890, 55.4},{"Timothy",144656, 77.8}};printf("Enter Student Name: ");gets(search_name);result1 = Search1(search_name, list);//Answer for part (a)(ii) – Display the matching index of result1printf("Enter Student ID: ");scanf("%d",&search_id);result2 = Search2(search_id,list);//Answer for part (a)(iii)- Display the matching index of result2return 0;}//Answer for part (a)(i) – function definition for Search1//Answer for part (a)(iii) – function definition for Search2Question > Not complete Marked out of 1.50 Flag question Previous page Write a recursive function named get_palindromes (words) that takes a list of words as a parameter. The function should return a list of all the palindromes in the list. The function returns an empty list if there are no palindromes in the list or if the list is empty. For example, if the list is ["racecar", "hello", "noon", "goodbye"], the function should return ["racecar", "noon"]. A palindrome is a word that is spelled the same forwards and backwards. Note: The get_palindromes() function has to be recursive; you are not allowed to use loops to solve this problem. For example: Test words = ["racecar", "hello", "noon", "goodbye", "test", 'aibohphobia'] ['racecar', 'noon', 'aibohphobia'] print (get_palindromes (words)) print (get_palindromes ([])) print (get_palindromes (['this', 'is', 'test'])) Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Result Precheck Check [] [] Next page
- *Coding language is Python Write a program that opens the productsales.txt file and reads the sales into a list. The program should output the following information, in this order: The total of all sales in the list The average of all sales in the list The lowest sale in the list The highest sale in the list NOTE: Your program should include at least one user-defined function, in addition to the main function. 4147 1594 2235 8433 10000 129 5555 7030 9764 7465 1111 4444 8954 2243 2895 1436 4978 5486 1436 9846 4789 8456 2497 2280 6375Question #2: Study the following C program and answer the below questions Hint: you might run it in Dev C++ before starting answering the questions! a) Show a sample output of the program. b) Extract a function declaration (prototype) for: 1) void functions with void argument 2) void function with a single input argument 3) function with a single input argument and return 4) a recursive function c) What is the difference between normal functions and recursive functions? d) How many times are the function print_stars() called in the program? (mention the line number of each call).Median Function – In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order. If the set has an even number of values, the median is the average of the two middle values. Your program should start with two arrays of integers containing the following values: Even numbered array: 17 32 45 68 99 101 67 89 22 27 Odd numbered array: 17 32 45 68 99 101 67 89 22 Using a sort function of your choice, first sort the arrays. NOTE: you may use the Standard Template Library sort function or your own sort function. Then, write a function that determines the median of a sorted array. The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array. The same function should be called twice – once for the even array and once for the odd array. Your program should also have a printArray function that can be used to print the sorted array. (It…
- After executing the following code segment the value stored in the variable "x" will be int List [1001; int x = 0; for (int i=1; i<100; i++) if (List [i]$2==1 && List[i]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.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.Related Topics: Struct Array Linked List Etc Write C++ code that reads students' grades from input data "studentgrades.txt", find each student's average. Inputted Data: (from a text file) fName Lname A B C D Hans Redolf 75 89 92 98 James Mith 89 76 85 92 Harry Monte 78 95 86 62 Kit Hamilton 91 92 93 94 Sample Output fName Lname A B C D Average Hans Redolf 75 89 92 98 91.2 James Mith 89 76 85 92 89.2 Harry Monte 78 95 86 62 90.4 Kit Hamilton 91 92 93 94 91.5 (after grade output, there are menus that also needed) a. List the students alphabetical based on First Name b. List the students alphabetical based on Last Name c. List the students based on Highest Average to Lowest d. List the students based on Lowest Average to Highest e. Print the results in data file "Output.txt" (each selected on menu should have clear screen and like refreshing the new grade outputs according to the selected menu and then show again the menus)Related Topics: Struct Array Linked List Etc Write C++ code that reads students' grades from input data "studentgrades.txt", find each student's average. Inputted Data: (from a text file) fName Lname B 89 A Hans Redolf 75 92 98 James Mith 89 76 85 92 Нarry Kit Monte 78 95 86 62 Hamilton 91 92 93 94 Sample Output fName Lname A B Average Hans Redolf 75 89 92 98 91.2 James Mith 89 76 85 92 89.2 Harry Kit Monte 78 95 86 62 90.4 91.5 Hamilton 91 92 93 94 (after grade output, there are menus that also needed) a. List the students alphabetical based on First Name b. List the students alphabetical based on Last Name c. List the students based on Highest Average to Lowest d. List the students based on Lowest Average to Highest e. Print the results in data file "Output.txt" (each selected on menu should have clear screen and like refreshing the new grade outputs according to the selected menu and then show again the menus)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.SEE MORE QUESTIONS