*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.
Q: Write a function named remove_names (names_list) that takes a list of names as a parameter, and…
A: Answer to the given question: Python Program for the given question is : new_lst=[] def…
Q: Programming using Python Filename: cards.py In this program, you will create functions that use…
A: Answer :
Q: Python: On-line Grocery Shopping Use grocery py in Canvas to start your program. It contains two…
A: Answer: Code: food = ["tomato_soup", "cheese", "sauce", "chicken"] stock = {"tomato_soup": 20,…
Q: Function: get_total_cases() takes the a 2D-list (similar to database) and an integer x from this…
A: According to the information given:- We have to create get_total_case() function to get 2D list of…
Q: Write a function that returns the greatest common divisor (GCD) of integers in a list. Use the…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED PYTHON FOR THE SOLUTION. Define…
Q: Write a python program that takes 5 positive integers from the user and prints the list after…
A: Please find the answer below :
Q: Write a function for solving a quadratic equation using the following header:def solveQuadratic(eqn,…
A: def solveQuadratic(eqn, roots): a = float(eqn[0]) b = float(eqn[1]) c = float(eqn[2])…
Q: PROGRAM A: APROGRAM.py This program should use a main function and two other functions named…
A: Given: PROGRAM A: APROGRAM.py This program should use a main function and two other functions named…
Q: 6.28 LAB: Output values in a list below a user defined amount - functions Write a program that first…
A: The source code is: #declare the function get_user_values() def get_user_values(): #declare the…
Q: Write a program to generate 10 random numbers from -100 to 100. Save the randomly generate numbers…
A: Python program to print random number between -100 to 100 an store in a list . Finding the count of…
Q: Functions, Iterations and List Write a function that takes a positive integer n as its parameter. •…
A: NOTE - Here I have used the Java programming language Here I have created a function named…
Q: python" Write a function named add_value that has a single parameter. This parameter will be a…
A: start define a function that takes list as a parameter append 21 in list stop
Q: python Write a function lottery() that simulates simple lottery program. This lottery program works…
A: import randomfrom operator import eqmenu_check = True# 'checker', compares userNums and winningNums…
Q: Problem Statement: Remove duplicate values from list In this lab, you will be building a software…
A: """Application that remove the duplicate values from the list""" #user define function to perform…
Q: get_column_choice(): this function will allow us to ask the players which pocket they want to grab…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Problem Attached
A: ONLY FIRST THREE PARTS ARE SOLVED. KINDLY SEND THE REMAINING QUESTIONS ON THE PORTAL FOR THEIR…
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: 6.24 LAB: Output values below an amount - functions Write a program that first gets a list of…
A: Algorithm: Start Read number of values n Read n integer values in a vector Read threshold value…
Q: 6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the…
A: def sum_highest_five(l): #takes list of numbers if len(l)<5:#if list has fewer than 5…
Q: Implement the following: 1) Write a function randFive() with one parameter n. 2) randFive() create…
A: Python Code for the above scenario :
Q: Return Growing NumList This function will be given a single number, it should return a list of…
A: The Answer is in Below Steps
Q: This assignment requires the main function and a custom value-returning function. The…
A: random.randint(200,250) : function imported using "import random" module, returns a random number…
Q: Python Programming Write a program that asks the user to enter a series of ten numbers. The program…
A: Program Plan: Create function numberOperration() to compute lowest, highest, total, and average. Use…
Q: IN PYTHON PLEASE!!! (Find the index of the smallest element) Write a function that returns the…
A: Given: IN PYTHON PLEASE!!! (Find the index of the smallest element) Write a function that returns…
Q: Activity #2: Vector Math This program is meant to give you practice with lists and looping on them,…
A: code :-- # get the tow vector and using list comprehension store each element in to list…
Q: Write a function that accepts a list as an argument (assume the list contains integers) and returns…
A: def getTotal(list): total = 0 for item in list: total = total + item return total
Q: Guess a letter: w wallaby You win! # The program selects the word platypus Guess a letter: b…
A: The given python code is examined and the respective needed changes are done on the given code and…
Q: Using Functions and Lists write a program where a function filterEvens takes a list of mix numbers…
A: In this program, We have t filter the even no output form all mix digit taken by the user by default…
Q: Write a program that will allow the user to specify the number of random numbers to be generated.…
A: In Python, random.randrange(start, end) function is used to generate the random numbers in a…
Q: Exercise 02 The call list (someString) transforms a string into a list of characters. Write the…
A: Step-1: Start Step-2: Call a function printAsString and pass list("hello") Step-3: function…
Q: An activity is carried out with many people, of which the only requirement of the activity is to be…
A: According to the guideline I need to answer only one question in a question but you asked 2…
Q: Create a function that finds if the elements of a list is palindrome number or not, in python…
A: Read the input. Check if it is palindrome or not. If yes return true, or return false. Print the…
Q: Create a c++ find function that finds a word or phrase within a string. This function should accept…
A: Here is the c++ code of above problem. Our input string was hello And the function will return 0,…
Q: Add 3 parameters to each function in the code below. *********************************************…
A: Random list created : [3, 2, 5, 6, 1] Specify what operations you wanna perform on the…
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: Given a list of numbers (nums), for each element in nums, calculate how many numbers in the list are…
A: Please find the answer below :
Q: elop a C++ code to computer the queries in X Y z format where you are given a list of size m. For…
A: Here have to write a C++ program according to the given instructions. Algorithm: 1. Take input from…
Q: Sample run Your program must define and use the following functions only: 1. read(): reads the city…
A: the code is an given below : def read(): cities = [] tempAvg = [] n =…
Q: About initial programming in python: Create a function that receives as parameters a list of 4…
A: We will create a function. This function will receive a list and a number. If the number is in the…
Q: Modify the sample code to prompt the user for a name. Have the program search the existing list for…
A: Lets see the solution.
Q: JS Write a function named list_concat that has a single parameter. This parameter will be a…
A: <!DOCTYPE html><html><body> <h2>Concatenate Lists</h2> <p…
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: Programming Problem Part 1 Write a function that will have a list as an input, the task of the…
A: In python, we need to define a function is to check if all the elements in the list are unique.
Q: A contact list is a place where you can store a specific contact with other associated information…
A: Step 1 The code is given in the below step
Q: PYTHON PLEASE Write a function that finds the smallest element in a list of float values using the…
A: The problem is based on the basics of functions in python programming language.
Q: Write a program that reads a list of integers, and outputs whether the list contains all multiples…
A: Python program for above : # function to check if list has all multiple of 10 def…
Q: 17. The following function takes a parameter that is a list of integers; the list has at least one…
A: The code given in question is: def findLarge(intlist): largest = 0 pos = 0 for i in range(1,…
Q: Please write a program that read the total rainfall for each of the 12 months into a list. The…
A: A Python program is as follows, File name: “main.py” #Define function for input def rainInput():…
Q: In loop_functions.py, define a function named list_concat that takes a single parameter li. This…
A: Reason for using FOR Instead of WHILE: This is because it is easier to use loops to iterate through…
Q: Problem Description A. Write a function named count_even(…) that receives as an argument a nested…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
*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
6375
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- (List maintenance) a. Write a complete C++ program that can be used to update an ordered list of numbers. Use the list of numbers shown in Figure 7.13 to test that your program is working correctly. b. Test the program you wrote for Exercise 4a, using a new part number of 86 with the list of numbers shown in Figure 7.13. This test should place this new code at the beginning of the existing list. c. Test the program you wrote for Exercise 4a, using a part number of 200 with the list of numbers shown in Figure 7.13. This test should place this new part number at the end of the existing listEx1: 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,…please code in python Assume you own a small cafeteria with very limited menu and you want to automate the orders. You have a list of menu items, a list with the price of these items. The number of elements in both lists should be the same. The program then asks the customer how many elements he wants from each item, then it should summarize the order of the customer and announce the price to pay. You can use the function from the previous exercise to check that the user enters a non-negative quantity each time.Assuming that we have:MENU_ITEMS=['karak','tea','coffee']PRICE_LIST=[2,1,5]You should get a sample run similar to that:How many karak do you want? 3How many tea do you want? 2.5Please enter valid quantity.How many tea do you want? -2Please enter valid quantity.How many tea do you want? 0How many coffee do you want? 1Your order is: - 3 karak - 0 tea - 1 coffeeYour total bill is 11 QAR.
- program7.pyThis program requires the main function and a custom value-returning function. In the main function, code these steps in this sequence: use a list comprehension to generate 100 random integers all from 1 to 100, inclusive. These represent the ages of a population of 100 people. pass the list as the sole argument to the custom value-returning function. In the custom function: sort the list in descending order using methods described in Chapter 7 return the sorted list to main Back in main: Within a for loop, print a 10 by 10 representation of the ages returned by the custom function. As listed in the example output, the ages should be in descending order and evenly spaced. Also, within the same for loop accumulate the sum of all ages. Using a built-in function determine the age of the oldest person, then print it . Using a built-in function to determine the age of the youngest person, then print it . Determine the average age by making use of the sum of all ages…python exercise: 1. Write a Python function called generate_quiz_question that takes a list of quiz questions (represented as tuples of the question and answer) as input and returns a randomly selected question from the list. The function should also prompt the user to enter their answer to the question, and then check whether the user's answer is correct or not. If the user's answer is correct, the function should return True. Otherwise, it should return False.Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe 123-5432 Linda…
- #### Part 1 Write a Python function (`binary_search`) that implements the binary search algorithm. This function will take a list argument (`values`), a value to search for (`to_find`), a start index (`start_index`), and an end index (`end_index`). The function will return `True` if `to_find` is present in `values`, and `False` otherwise. Below, you will find some code to test your binary search: ```python values = [2,4,6,8,10,12,14,16,18,20] print(binary_search(values, 14, 0, len(values) - 1)) print(binary_search(values, 7, 0, len(values) - 1)) ``` The output of the test code is below: ``` True False ``` #### Part 2 Modify your `binary_search` function to count the number of comparisons (==, <, <=, >, or >=). The function will now return both the number of comparisons made and the `True` or `False` result. The code below calls your function, and creates a simple ASCII bar chart of the number of comparisons (divided by 10, to account for small differences). Some…Q1) Using Functions and Lists write a program where a function filterEvens takes a list of mix numbers and return it by filtering all the evens out. You can take list items from user or create static, and then passed it to function. The output should be the list with only evens example input_list = [12, 5, 7, 8, 2, 4, 1] output = [12, 8, 2, 4]. Please do in python. Thankspython exercise: 1. Write a Python function called generate_quiz_question that takes a list of quiz questions (represented as tuples of the question and answer) as input and returns a randomly selected question from the list. The function should also prompt the user to enter their answer to the question, and then check whether the user's answer is correct or not. If the user's answer is correct, the function should return True. Otherwise, it should return False. 2. Write a function is_palindrome(s) that takes a string s as input and returns True if s is a palindrome (i.e., reads the same backwards and forwards), and False otherwise 3. Write a Python function called get_top_students that takes the list of dictionaries as input and returns a dictionary containing the name and GPA of the top two students in the list. Each dictionary has the following keys: "name", "age", "major", and "gpa".
- #python Write a function lottery() that simulates simple lottery program. This lottery program works as follows, Randomly generate 6 different integers between [1,49] and keep them in a list. Take 6 integers from the user and keep them in another list*. Check how many integers the user guessed correctly. At the end sort randomly generated numbers and user’s numbers, print them with the number of correct guesses. Check the entered number is inside the range [1,49] if it is not, ask again. The user needs to enter a number that doesn’t entered before.Python Programming - (Duplicate Elimination) Part 1: Create a function that receives a list and returns a (possibly shorter) list containing only the unique values in sorted order. Test your function with a list of numbers and a list of strings. Program is to also display results, that's the sorted list containing values. Part 2: Instead of hard coding the list passed to the sorting functions, request list values from user. (Hint: Request two lists from user, one containing values and another containing string.) Have the program eliminate duplicated values and display the lists (tasks required in part 1).22.4 LAB: Adjust list by normalizing - functions (Use Python) When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. Input values should be added to the list until -1 is entered. Ex: If the input is: 30 50 10 70 65 -1 the output is: 20 40 0 60 55 Your program must define and call the function:get_minimum_int(nums)