The list Q has numbers 1, square root of 2, x, and x^2, where x>0 and the range of the numbers in the list is 4. quanity A= x quanity b= 2 which quanity is greater?
Q: Given list_nest=[['a','b','c'], [1,2,3], ['zebra','xerox','yes']], what is result of…
A: We are given a list named list_nest and it has ['a','b','c'] , [1,2,3] , ['zebra', 'xerox', 'yes']…
Q: write simple python code and create a list mean: and returns the average
A: start create a list mean define a function cal_mean(n) calculate average return average print…
Q: Given list L of 32 signed Integers each of 16 bits and a key X (16 bit). within L, return -1 if X…
A: C Code :- #include <stdio.h>int BinarySearch(int array[], int start_index, int end_index, int…
Q: Consider the list [1, 2, 3, 5, 8, 13, 21]. We want to find the values which are either even or…
A: #incorporate <iostream>utilizing namespace sexually transmitted disease; // Result work with…
Q: Write a program that reads three issues and arranges them in a differential order? te…
A: There are 2 Questions: 1) Write a program that reads 3-issues and arranges them in a differential…
Q: n a doubly linked list of five nodes, if n points at the first node and p points at the second node,…
A: as, p is pointing to 2nd node. so, p.prev will point to 1st node. Hence, p.prev.next will point to…
Q: Given the positive integer n create a list consisting of the portion of the Fibbonacci sequence less…
A: logic:- set a=0 b=1 read n fib=[] sum=0 fib.append(sum) while True: a=b b=sum sum=a+b if…
Q: Write a python program to find the first occurrences of user entered number in a sorted list using…
A: Required:- Write a python program to find the first occurrence of user-entered number in a sorted…
Q: Consider a double 1inked List that stores names of all customers of a company in ascending order of…
A: An algorithm is a set of instructions for solving a problem. Given The double linked list is in…
Q: Write a python program to find the index number of last location of a user inputed number in a…
A: Write a program that takes one numbers as input and display the index number of last location of a…
Q: Write a php program to remove duplicate from a sorted list. List is given to you don't take from…
A: Required:- Approach:- Take the list and then using the inbuilt function array_unique function we…
Q: If X value in the list below is searched using binaryserach, after how many attempts, it will be…
A: The given is a sorted list of characters and the requirement is to search X and fund the number of…
Q: For each of these lists of integers, provide a simple formula that generates the terms of an integer…
A: a. 6, 9, 14, 21, 30, 41, … 9-6=3 14-9=5 21-14=7 30-21=9 41-30=11 54-41=13 69-54=15 86-69=17 b.…
Q: A single domino tile is represented as a two-tuple of its pip values, for example (2, 5) or (6, 6).…
A: Python used to answer this question
Q: Given two lines, determine whether or not they are parallel. Lines are represented by a list [a, b,…
A: CODE: print("To determine the lines are parallel or not \n") def lines_are_parallel(line1, line2):…
Q: In PHP language write a program to remove duplicates from a sorted list. Given list:…
A: Write a program in PHP language to remove duplicates from a sorted list. Given List:…
Q: Suppose you have a table t with a column labeled 'XYZ. What is the difference between t.YYZ.cumsum()…
A: Answer: For each row of the table t.YYZ.cumsum() sum of the all values of the column XYZ. For each…
Q: Write a python program to find the median of two lists when the lists are merged into a single list.…
A: logic:- iterate for each element in lst1 and append it to lst3. End loop Iterate from i=0 to…
Q: Which of the following is false in reference to python ? O Tuple is an unordered sequence and…
A: The question requires to Identify which of the given option/s is/are false with reference to python.…
Q: Consider a long list of numbers such that: 15% of the entries are 1; 50% of the entries are 1; 10%…
A: Answer is given below-
Q: Consider two lists A and B such that A returns [1,3,5] and B returns [1,3,5]. 1. Create A and B so A…
A: Two list are created using Python code In Python A is B means that both list object should point…
Q: Which of the following lists indicates the order in which the nodes are inserted in the queue Q of…
A: Given :
Q: Question 1 What are the running times of the following function in the best and worst cases? Assume…
A: In this question, we are given a function sum with size of list 'n'. We are asked the best case and…
Q: Given a sorted list below, write a PHP program to remove duplicates from that Given List:…
A: Given a sorted list below, write a PHP program to remove duplicates from that list. Given List:…
Q: Which of the following is false in reference to python ? Tuple is an unordered sequence and mutable…
A: Option A
Q: Consider the list y list [1880, 990EZ', 'Tax Forms'] Which statement gives '990EZ as the output? O…
A: Lost indexing starts from 0 and when we want to print the second element then we have to print only…
Q: What is the length of the following list? Equivalently, if the list below was assigned to the…
A: The given list is: [[False], [1, 6, 9], ['pao'], [7, 3, 5, 2], [False], 'a']
Q: Write a function that returns of multiples of n in given list. Ex: [12,41,63,21,52,17,18] n=3…
A: def multpiles_of_n(l,n): res=[] # taking empty list for i in l: #iterating over the list…
Q: Write a PHP program to remove duplicates from a sorted list. Given list : (1,2,2,2,3,3,4,5,5,6,6,7)…
A: Given: Write a PHP program to remove duplicates from a sorted list. Given list :…
Q: What is the Big Theta runtime of this function, where n is the length of the list? def f(1st): i = 1…
A:
Q: You have given a list of q queries and for every query, you are given an integer N. The task is to…
A: Algorithm: Start Implement threeDivisors() method which takes an array list and its size as…
Q: For an alphabet of size R, N total keys, and an average key length of L: (a) What is the minimum…
A: In an R-way search layer, the minimum number of connections is R - 1. In an R-way search layer, the…
Q: What is the length of the following list? Equivalently, if the list below was assigned to the…
A:
Q: Given a list (6, 7, 8, 2, 16, 1, 22, 21, 4, 9, 13,17,18,23,24) and a gap value of 3: What is the…
A: Given: list = 6, 7, 8, 2, 16, 1, 22, 21, 4, 9, 13,17,18,23,24 and a gap value of 3.
Q: How to convert the following dictionary into expected outcome list in python? dictionary = {…
A: To get the items of this dictionary in a list first iterate over the dictionary. For each key, get…
Q: What is the Big Theta runtime of this function, where n is the length of the list? def f(1st): i = 1…
A: The code snippet given:- def f(lst): i = 1 while i < len(lst): j = i + 1…
Q: When an author produces an index for his or her book, the first step in this process is to decide…
A: //Data stored in the node type struct WordCount { string word; int count; }; //Node type:…
Q: Implement an employee list with XML and XSLT including Employee ID, Employee Name, Joining Date and…
A: Extensible Markup Language (XML) can be defined as a markup language and file format for storage,…
Q: 04. Let E = {0, 1} and A, B be the list of three strings each. Verify below PCP has a solution or…
A: the following answer is in the below step ?
Q: Write a python program to create a list of even numbers and another list of odd numbers from an…
A: The required python program is in the next step using for loop.
Q: Write a Program in Python to Split a List Into Evenly Sized Chunks using yield method.
A: Given: Write a Program in Python to Split a List Into Evenly Sized Chunks using yield method.
Q: For a list L, L[i] = item operation is a ____ operation, if i is less then len(L). Question 8…
A: Here, in this question, they have given list and asked complexity. You can determine complexity like…
Q: What is the Big Theta runtime of this function, where n is the length of the list? def f(1st): i = 1…
A: Answer ; This code does not run and terminate. THis will show error.
Q: IN PHP Programming Language For a given number of whole numbers $ arr and the number $n, find a pair…
A: Algorithm - Create a function with the name simplePair and two argument. use the for loop over the…
Q: Q2: Create a data frame in python pandas of two column as given below, Name Salary Tom 20…
A: Introduction :Here , we have given with the two columns of the data, and we have asked to create the…
Q: Consider the list {23, 23, 23, 23, 40}. What is the SD of the list when the values are in standard…
A: Standard deviation of the list using C++ program
The list Q has numbers 1, square root of 2, x, and x^2, where x>0 and the range of the numbers in the list is 4.
quanity A= x
quanity b= 2
which quanity is greater?
Step by step
Solved in 2 steps
- 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.1. For the following diagrams, mention and briefly explain each control instruction. choice choice instruction instruction instruction 2. Consider a four-hour film to be displayed on a computer at 24 fps. Each frame is 420 x 270 pixels and a 24-bit RGB color encoding is being used a. How many bytes will be required to represent the whole film? In how many gigabytes the film in (a.) can be represented?During tough times like these, investment becomes more uncertain with more dangers. To solve it, we might try to train a model to decide when to buy or sell. Therefore, to provide it with correct data, we plan to design an algorithm that answers: what is the perfect moment to buy and when to sell to maximize your profit? Assume you must buy Input: changes : array listing changes in the prices, where indices represent days; it has at least two values Output: i : index of the change before which we buy j: index of the change before which we sell maxProfit : the profit of this interval Example: Assume the below table contains the prices of a particular stock over days prices changes Day Value 50 1 63 13 70 7 3 40 -30 55 15 65 10 6 60 -5 7 72 12 8 79 7 9 68 -11 10 74 6 Therefore, the output of maxProfit([13,7,-30,15,10, -5,12,7, -11,6]) should be (3, 7, 39) . This is because our maximum profit would be 39 when we buy the stock at day 4, index of 3, and sell after day 8, index of 7. Then,…
- If A={8,12,16,20} and B={12,16,20,24,28}, what is the value of P (A and B)?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.…Suppose you have a sitting arrangement of the students of the final exam in a list. The list contains the last two digits of their roll number. sitting_list=[10,30,20,70,11,15,22,16,58,100,12,56,70,80] Now you want to organize the sitting arrangement. You decided to sort all the students in the even indices into ascending order and all the students in the odd indices into descending order. So write a python program that organizes the list for you the way you decided. Sample Output[10, 100, 11, 80, 12, 70, 20, 56, 22, 30, 58, 16, 70, 15]
- Given integer inputs seed, how_many, and max_num, generate a list of how_many unique random integers from 0 to max_num (inclusive). Complete function unique_random_ints(how_many, max_num): Generate a list of how_many random integers from 0 to max_num (inclusive). When a random number exists in the list, a new random number must be generated; use a global variable, retries, to count the number of times an existing number is generated. Return the list. Complete __main__: Initialize the random module with the seed value. Call unique_random_ints() to get a list of random integers. Output the list of random integers and the value of retries, according to the output format shown in the example below. Ex: If the input is: 2 5 7 the output is 0 1 5 2 4 retries=1Suppose 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 lowestThere is only one list of N ingredients in the menu. Every ingredient has its beauty value that does not depend on its taste, but on the way it looks, which is expressed as a positive integer. To order a dish, the customer asks Ramsay to use all the ingredients from L to R (L is strictly less than R). Ramsay knows that the dish will be tasty and not only beautiful if the sum of its ingredients' beauty values is divisible by K. Ramsay does not want to use all the ingredients, so he always excludes one of them. Which one? - The least beautiful one! (in other words - which has the minimal beauty value). Now he wonders - how many segments (L,R) are there such that the sum of their beauty values will be divisible by K after excluding the least beautiful ingredient. Your assignment is to develop a python code that prints the answer for the problem. Sample test case are given below:Input:3 21 2 3Output:1
- 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']…There are 26 students in COMP 3140 class. Generate a list of lists named L. Each list in L contains 5 random grades (60-100), representing the grades of 5 assignments of a student. Using Python high order function – Mapping, compute the average grade for each student.She gets the cheapest one for free, so she ends up paying $15.99 + $23.50 = $39.49, but what her receipt says is: ● ● ● Product A: $15.99 - Special Discount = $12.57 Product B: $23.50 - Special Discount = $18.47 Product C: $10.75 - Special Discount = $8.45 Total: $39.49 Create a function that takes in a list of prices for a customer's shopping cart and returns the prices with the discount applied. Round all prices to the cent. Examples discount ([2.99, 5.75, 3.35, 4.99]) →[2.47, 4.74, 2.76, 4.12] # First product for free. discount ([10.75, 11.68]) # No discounts applied. [10.75, 11.68]