A person is trading his money in the stock exchange market. Assume that the daily price of a specific market along a certain period of time is given as follows: Price [200, 500, 800,100, 300, 50] all in Dollar. This means that the price of the stock in the first day is 200$ and the day after which is mean the second day the price is going up to be $500 and so on until the end of the week or the list you are given. You are allowed to buy and sell the stock only once, which means that if you buy it on the first day then you will pay 200$ then if you decided to sell it on the third day then you will get $800 the your profit will be $600. Another example: prices = {300, 450, 720, 90, 30, 50, 900, 500, 70}; Output: Buying date: day 5, at the price of $30 selling date: day 7, at the price of $900 Maximum Profit: $870
Q: Write a program that reads an integer, a list of words, and a character. The integer signifies how…
A: Code:
Q: owing information: New Customer Revenue e.g., new customers not present in previous year only Lost…
A: Q A data set has 4 columns--index, CUSTOMER_EMAIL, Net Revenue, and Year. For each year we need…
Q: Write a line of code in R that will change the Location column of the tibble in my_Costco_list to an…
A: R is а рrоgrаmming lаnguаge fоr stаtistiсаl соmрuting аnd grарhiсs thаt yоu саn use tо…
Q: The list Q has numbers 1, square root of 2, x, and x^2, where x>0 and the range of the numbers in…
A: The numbers in the list Q are 1, 1.414(square root of 2), x and x2 As x>0 The range of a list is…
Q: In C++. When analyzing data sets, such as data for human heights or for human weights, a common step…
A: Take a variable to store the size of the vector. Take a variable to input the number for the vector.…
Q: Write a program that reads a list of integers, and outputs whether the list contains all multiples…
A: Python Program: # function for checking if all elements are multiple of 10def…
Q: We have a list that stores the repeated heart-rate measurements for the same patient over several…
A: 1) Below is progtram to defines function calculate_average_heart_rates which takes list that stores…
Q: You'll be given the weights of different passengers of a bus as input. The passengers can normally…
A: Here no language is mentioned so I have provided c++ code for a given scenario.
Q: A Football Scores The number of goals achieved by two football teams in matches in a league is given…
A: Java code is as follows :
Q: Given a set, weights, and an integer desired_weight, remove the element of the set that is close st…
A: Explanation:: Code in PYTHON is given below Output is provided at the end Code in PYTHON:…
Q: Write a function count_repeated that takes two lists as a parameters and prints out the number of…
A: I give the code in Python along with output and code screenshot
Q: # For sımplicity, we'll use "Station in our type contracts to # we mean a list containing station…
A: Algorithm: Start the program. Read the latitude, longitude and list of hand out stations. Pass it…
Q: Write a function combine(names, ages) that takes in two lists, names and ages and returns a list of…
A: The program requires combining two lists in the form of key-value pairs where the first list the key…
Q: Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student…
A: It is given that a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each…
Q: Write a program in C++ that asks the user to input 2 lists of numbers, 5 numbers per list. Your…
A: Introduction of Program: The C++ program takes 5 elements in the first list and 5 elements in the…
Q: Write a function print matching_indexes (items, target) that prints the indexes of all the…
A: The range(start, end, interval) function takes three input arguments. The range function returns the…
Q: On Assignment 4, Question 1, you were asked to solve the Assignment Difficulty problem. Now you're…
A: The test function details is given in next step:
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: You will be given a positive integer n>0 and you will construct a pattern that is made up of n rows:…
A: Bell’s Numbers and the Bell Triangle are a sequence of numbers which count the possible partitions…
Q: readings from a fridge, as described in Question 9. Write a program that prints the hour at which…
A: Please check the step 2, 3, & 4 for solution of the question
Q: Given the non-negative integers m and n (with m<n), create a list of triangular numbers between (and…
A: Solution :
Q: We need to store information about each student in a class of N students. For example,name,…
A: Program: #include <iostream>using namespace std; //defintion of class Studentclass Student{…
Q: Write a python program to display a receipt of ordered foods by a customer at a restaurant. The…
A: Based on python
Q: program is to be written in c Write a program that first gets a list of integers from input. The…
A: #include <stdio.h>#include <stdlib.h> //function declarationvoid…
Q: Write code in C++, C# or Python to solve the following problem: In a party there are N persons and…
A: ANSWER:-
Q: Write a function removeN which takes three arguments called N, E and L (where L is a list) and…
A: This is a simple problem where we can use the remove operation of list in python and with few check…
Q: t allows the user to enter the series of game points, then -1 to signal the end of the list.
A: Approach Here, while loop executes until the user entered -1. In each iteration, the sum is computed…
Q: Write a function find triplets that (1) is given a list and a target value and (2) returns a list of…
A: def find_triplets(A, target): result = [] arr_size = len(A) for i in range( 0, arr_size-2):…
Q: Suppose I wanted the fourth element of some list L. Which of the following puts the value of the…
A: Given: Adding Fourth Element to the given list.
Q: the below function, viral-growth in Racket, so that it can be passed to the below repeated function…
A: It is defined as general purpose programming language. It consists of definitions and expressions,…
Q: #in c++
A: The algorithm for creating the program with given description is as follows: Create a class Student…
Q: You want to prove to your parents that you are a scholar. Naturally, the more books you've read, the…
A: The program is implemented in c. Please fine the program in step 2.
Q: Below is a bubble_up function that takes 3 parameters: the list, a start index, and an end index,…
A: Solution is given in next step :
Q: Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student…
A: Here I have defined a custom method named sortDict() that takes a dictionary as an input parameter…
Q: Write a function inde which returns the index (start from 1) of the occurrence of a given value. Use…
A: NOTE - I have used the Python programing language. As per our guidelines, we are supposed to answer…
Q: The function returns the absolute value of the sum of the every other nth element of L
A: Program: # Python Version 3# function to return the absolute value of the sum of the list…
Q: In python We have a list (named data) of numbers sorted in ascending order, for example: data…
A: I have given an answer in step 2.
Q: Given a list of items with a value, and a start and end flag, implement a function that calls…
A: Answer is given below-
Q: Write a program that process 10 assessment marks of student. Input the marks and process the data to…
A: The program is written in C Language. Please find the program code and comments in step 2.
Q: In the continuation of the previous question In that question I asked for front element and in…
A: Required:- In that question, I asked for the front element and in this question I asking about the…
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: rite a function numPairs that accepts two arguments, a target number and a list of numbers. The…
A: The complete code is given below.
Q: a) Suppose we are trying to hide a secret message by embedding it in random extra letters. Write a…
A: Below is the code in python as language not specified and sample output:
Q: Write a program that reads a list of integers, and outputs whether the list contains all multiples…
A: Answer
Q: In C++ Write a program that replaces words in a sentence. The input begins with an integer…
A: Step 1 The code is given in the below step.
Q: Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student…
A: The Answer is
Q: Write a function that takes two lists as input, a list L1 containing characters and a list L2…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT------------
Q: Write a program to calculate the total price for car wash services. A base car wash is $10. A…
A: Lets see the solution.
Q: ht reservation system, the number of available seats in each plane model is an input. A plane may…
A: Basically, Boundary Value Analysis is a technique that is used for software testing. The valid and…
full answer, please
Step by step
Solved in 2 steps with 2 images
- A person is trading his money in the stock exchange market. Assume that the daily price of a specific market along a certain period of time is given as follows: Price [200, 500, 800,100, 300, 50] all in Dollar. This means that the price of the stock in the first day is 200$ and the day after which is mean the second day the price is going up to be $500 and so on until the end of the week or the list you are given. You are allowed to buy and sell the stock onlyonce, which means that if you buy it on the first day then you will pay 200$ then if you decided to sell it on the third day then you will get $800 the your profit will be $600. another example: prices={300,450,720,90,30,50,900,500,70} output: Buying date: day5, at the price of $30 selling date : day7, at the price of $900 Maximum profit:$870 You are requested to develop an algorithm to maximize the profit in single buy and sell.Write code in C++, C# or Python to solve the following problem: In a party there are N persons and we have M raffles. One person may participate in any number of raffles (from 0 to M). At the end of the day, host of the party comes to you and gives you M lists. Each list contains multiple integer numbers which are the "raffle ID numbers" of the participants. Then, for each list an integer number, I, is announced to determine the winner of the raffle: the winner is the person with raffle ID number K such that K is larger than exactly I numbers in that list. To help the host to find the winners you want to write a program. Input Format First line of the input is N and M. Then, there are M lines, each one contains integer numbers between 1 and N. Each list may contain at most N numbers. At the end of each line there is -1. After these lines there is one line which contains M integers to announce the winners. If the j-th number in this line is I it means that the winner of list j…Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a course name as input from the user and sort the list based on the marks obtained in that course in order to finally print the names of the students in descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest. For example, the list may look likelst = [ ["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ]where for each nested list, 1st index holds the name of the student, 2nd index is total marks earned in the CSE110 course, 3rd index is PHY111 marks and 4th index is MAT110 marks. ===================================================== Hint:You may create a function for sorting, then call it every time when needed instead of rewriting the code. You may get the data in the individual lists from the given nested list.…
- (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…Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a course name as input and sort the list based on the marks obtained in that course to finally print the names of the students in descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest. For example, the list may look like stu_lst = [ ["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ] where for each nested list, 1st index holds the name of the student, 2nd index is total marks earned in the CSE110 course, 3rd index is PHY111 marks and 4th index is MAT110 marks. [You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead] =============================================================== Sample Input 1 MAT110 Sample Output 1 ['Alan', 'Musk', 'Turing', 'Elon']…Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a course name as input and sort the list based on the marks obtained in that course to finally print the names of the students in descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest. For example, the list may look like stu_lst = [ ["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ] where for each nested list, 1st index holds the name of the student, 2nd index is total marks earned in the CSE110 course, 3rd index is PHY111 marks and 4th index is MAT110 marks. [You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead] =============================================================== Sample Input 1 MAT110 Sample Output 1 ['Alan', 'Musk', 'Turing', 'Elon']…
- Write in C++ Now, what if Sam wants to insert Eevee after Pikachu but he doesn't know where Pikachu is located in his list. Let's help him search for a Pokemon by its name and insert another Pokemon directly after it. Write a function secondPlace() that takes six parameters and inserts a new Pokemon into a list right after another specified pokemon. Once you find the specified Pokemon, use the insertAfter() function from the previous sub-question to add the new Pokemon. The function should return the new number of strings in the array. Note The same Pokemon may appear in the list multiple times (Sam has a bad memory). Assume that Sam wants every instance of the Pokemon he is searching for to be followed by the Pokemon he is attempting to insert. If the array is already full or if the number of strings that are going to be added to the array plus the current number of strings exceeds the total size of the array, the array should remain unchanged. Assume all inputs are lowercase…Computer Science (in picat) 10. split list(Lst,N): split Ist into two parts with the first part having N elements, and return a list that contains these two parts. 12. min max median(st): a function that takes a simple list of numbers Ist as a parameter and returns a list with the min, max, and the median of Ist. Can you devise an algorithm that has an expected linear running time?rite a function numPairs that accepts two arguments, a target number and a list of numbers. The function then returns the count of pairs of numbers from the list that sum to the target number. In the first example the answer is 2 because the pairs (0,3) and (1,2) both sum to 3. The pair can be two of the same number, e.g. (2,2) but only if the two 2’s are separate twos in the list.In the last example below, there are three 2’s, so there are three different pairs (2,2) so there are 5 pairs total that sum to 4. Sample usage: >> numPairs( 3, [0,1,2,3] )2
- Suppose a list contains the final exam results of CSE110, PHY111, and MAT110 of each student in a listed form. Your task is to sort the list based on a course name that will be given by the user and print the names after sorting. For example, a list looks likelst = [ ["Farzad",95,87,91] , ["Mahjabin",92,90,83], ["Sadman",87,92,80], ["Nakhla",85,94,90] ]where for each list, 1st index is name, 2nd index is CSE110, 3rd index is PHY111 and 4th index is MAT110. ===================================================== Hint:create a python function for sorting, then call it everytime instead of rewriting the code. Get the data in the individual lists from the given nested list. ===================================================== Sample InputMAT110 Sample OutputFarzadNakhlaMahjabinSadmanthis 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.The English HOD asked you to write a small program to assist the English teachers toRAMDOMLY assign learners to do their oral examinations. Each teacher has adifferent number of learners in their class, so they will have to put in the number ofstudents on a form. The program should then randomly return a number (which areallocated to each learner on the teacher’s class list) AND check whether the newlyallocated number has not been used before. Your program therefor only has to returnthe following output:Slot 1 – Learner number 37Slot 2 – Learner number 23Slot 3 – Learner number 18Slot 4 - Learner number 7Slot 5 – Learner number 1 (etc.)You decided that this will be a fun project to give to your IT learners. a. Write a memo (which includes the whole program code)b. Indicate how you will assess and allocate marks to the learners.