a- Write a Python function Salary_levels, that takes a list as an argument and returns the number of the high salaries (salary>=5000), the average salaries(1000<=salary<5000, and the low salaries (salary<1000). You can use the following list : salaries= [500,1070,1450,6500,9000,940,450,400,600,2750,1100,8400,1500,900,1200] b- Use the above function to print the counts of the high, average, and low salaries. N.B: the codes of parts a and b should be included in your answer.
Q: Write a function that takes list and a number (x) as parameters. Assume list contains only numbers,…
A: - We need to solve the number list problem in python.
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: print_smallest_and_largest_even Write a function named (numbers_list) that takes a list of numbers…
A: Finding smallest and largest Even number from list using python
Q: Algorithm Efficiency 1- Programming Problem Part 1 Write a function that will have a list as an…
A: the answer is given below:
Q: In program problem6.py, write a function named longestCommonSuffix to find the longest common suffix…
A: #function to find and return the longest common suffix of list of numbersdef longestCommonSuffix(l):…
Q: ríte a function called filler(A, 1) hat takes an integer A, and a list of integers 1 nd if some of…
A: Input : Input A Input l Output : Output the numbers from list that adds up to A.
Q: Write a function that will accept an empty list then populate it with 100 integer test scores from…
A: Python is an interpreted program, object-oriented language, high-level programming language with…
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: Exercise 3: Single parameter Write a function print_even() which • takes a list of integer numbers…
A: A number is said to be an even number if the number is divisible by 2 and the remainder of the…
Q: Write a function named mostCharacters that takes a list of strings as an argument and a character as…
A: we want a function that names"mostCharacters'" that take a list of strings as an argument and a…
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: Write a function that does the following: 1. Its name is flatten. 2. It will take one parameter,…
A: ALGORIHTM / STEPS: Create a new list for storing the elments of numbers list Traverse through…
Q: o Write a function called average(list) that takes a list as a parameter and returns the average.…
A: ALGORITHM:- 1. Declare and initialise the list with the elements. 2. Pass it to the average()…
Q: Part I Implementation In this part you are asked to write functions with python • Define a two…
A: import random def print_table(table): for i in range(n): for j in range(n):…
Q: In OCaml Programming Language, write a function: val prime_separator : int list -> int list * int…
A: val prime_separator : int list -> int list * int list = <fun> that takes an integer list as…
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: A supermarket wants to reward its best customer of each day, showing the customer’s name on a screen…
A: As programming language is not provided I am assuming it to be python. Program code is given below.…
Q: Write a function numPairs that accepts two arguments, a target number and a list of numbers. The…
A: below is the code for given python program:
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: Please use python for this problem: Please use Python when answering the question: Question…
A: Python is a high level programming language. Guido van Rossum, is the father of Python. Just like…
Q: primeFac (Perkovic, Problem 5.42) Write a function primeFac that computes the prime factorization of…
A: PROGRAM INTRODUCTION: Start the definition of the function to find the prime factors of the number…
Q: CH7: Problem 1: Lo Shu Magic Square 15 The Lo Shu Magic Square is a grid with 3 rows and 3 columns,…
A: Python code: def generateSquare(n): # 2-D array with all # slots set to 0 magicSquare = [[0 for x…
Q: Write a function flat_list() which takes a list that contains unknown number of lists. This function…
A: new_li.append(ele): append ele in new_li in last position previous: new_li = [1, 2, 3] after…
Q: Write a function list2DigitOdd() that creates and returns a list that contain all positive 2-digit…
A: I have given an answer in step 2.
Q: Write a function that takes two lists as input, a list L1 containing characters and a list L2…
A: Note: The programming language is not mentioned so python is used for the solution. Algorithm:…
Q: Questions P1 and P2 are related to the following code segment. Below is the skeleton of a function…
A: def f1(n):#takes a list of integers for i in range(0,len(n)-2):#runs for i=0 to length of n-3…
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: 15- Write a function that takes two positive integers as a parameter .The first integer is the…
A: Provided below is the program which takes two positive integers from user for number of heads and…
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: Write a function that accepts two lists as it's only arguments. The function should return a new…
A: PYTHON code for above : # required function for above def func(list1, list2): list3 = list1…
Q: A cyclist has several rides each day. After each ride she records the number of miles she has…
A: In the question it is given that cyclist has ridden different number of miles per day. So we
Q: 1 - Write a Python function that will do the following: 1. Ask the user to input an integer that…
A: Given: 1 - Write a Python function that will do the following: 1. Ask the user to input an integer…
Q: Write a function named mostCharacters that takes a list of strings as an argument and a character as…
A: Program: Programs are used to provide the instructions to the system. It is used to solve complex…
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: Write a function that will accept a list of integers and return the sum of the contents of the…
A:
Q: The function list_combination takes two lists as arguments, list_one and list_two. Return from the…
A: Python is a very famous programming language these days, It is an Object oriented programming, which…
Q: a. Write a function called Jumble that takes a list as a parameter. The function should ask the user…
A: 1. We need to switch 2 random elements from the list. For that, we can make use of the 'random'…
Q: Write a program to print the lyrics for ten verses of "The Ants Go Marching". A couple of sample…
A: Now, we have to create a lyrics() function that will take two arguments, first one is for number and…
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: Write a function called remove_odd that takes a list of numbers that have both even and odd numbers…
A: Given: Write a function called remove_odd that takes a list of numbers that have both even and odd…
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: You'll write a function altSum(1st: list[int]) -> int that takes a list of numbers and returns the…
A: Here I have created a function named altSum(). In this function, I have checked for the size of the…
Q: Create a function that takes two numbers as arguments (num, length) and returns a list of multiples…
A: # As no language is mentioned, the program is written in Python language. def…
Q: program to be written in C Write a program that gets a list of integers from input, and outputs the…
A: It repeatedly swaps the adjacent elements if they are in the wrong order. First Pass: 5 1 4 2 8…
Q: python wirte a function max_indexes(xs) that inserts a list xs with numbers and returns a list of…
A: PROGRAM: #Defining max_indexes() def max_indexes(xs): #Defining list to store the…
Q: Write a function named listReplace that takes 3 arguments: list1, tuple1, and tuple2. The function…
A: PROGRAM EXPLANATION: Define a function list Replace. This function will receive 3 arguments: list1,…
Q: this code should be in python: write a function that receives a list as its only parameter. Inside…
A: Introduction: this code should be in python: write a function that receives a list as its only…
Q: Write a function named find_mode () that takes a list as its only argument. Your function then…
A: The mode function is used to find the most frequently occurring values in a list. The below step…
a- Write a Python function Salary_levels, that takes a list as an argument and returns the number of the high salaries (salary>=5000), the average salaries(1000<=salary<5000, and the low salaries (salary<1000).
You can use the following list :
salaries= [500,1070,1450,6500,9000,940,450,400,600,2750,1100,8400,1500,900,1200]
b- Use the above function to print the counts of the high, average, and low salaries.
N.B: the codes of parts a and b should be included in your answer.
Step by step
Solved in 3 steps with 1 images
- Python programming. For this program, you need to write a function that processes a list, then tests the function with extreme values (min and max) Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f=p×(1+i)t• f is the future value of the account after the specified time period.• p is the present value of the account.• i is the monthly interest rate.• t is the number of months.Write a program that takes the account's present value, monthly interest rate, and the number of months that the money will be left in the account as three inputs from the user. The program should pass these values to a function that returns the future value of the account, after the specified number of months. The program should print the account's future value.Write a function named how_many(a_list, a_num) that that expects a list of numbersand a number as arguments. It returns how many times the number is found in the list.If the number is not in the list, return 0. For examplehow_many( [12, 15, 16, 4, 10, 3, 5, 7, 9, 15], 15 )returns 2 And how_many( [12, 15, 16, 4, 10, 3, 5, 7, 9, 15], 11 )returns 0Ask the user for an integer between 0 and 19. If the number is in the list, report howmany times it occurs.1) Write a function dropLowest() with one parameter n.2) n is a list that contains any 5 random integers in the range (1,100) inclusive.3) The function should return the updated list which drops the lowest number in n.4) Call the function, dropLowest() with the argument n, n = [10, 44, 8, 78, 60].5) Print the result of the function call. Example Output (n is the argument)[10, 44, 78, 60] PYTHON PROGRAMMING
- Write a function that takes list and a number (x) as parameters. Assume list contains only numbers, the function displays all of the numbers that are greater than x, and return true. If the function does not find any number greater than x, return your false which indicates an error.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 and the input should be given by user. For Example: If we call the function with [“dad”, “aunt”, “mom”, “sister”, “mom”] as its user input, the returned value should be [“dad”, “aunt”, “mom”, “sister”]. The order of the items inside the returned list does not matter.Python please... Implement a function printIndex() that takes a list as a parameter, prompts the user to enter a whole number n, and prints the element in position Index[n]. If the list is empty ([]) or n is not a valid index into the list, the function will not print anything. Be careful to do the correct thing with negative indices. You should assume that the user will enter a whole number when prompted, and the function will crash if the user does not enter an integer. The function should not change the list passed as a parameter. Hint: Just because this involves a list does not mean that you need a loop to solve the problem. Think carefully about the right construct to use here. The following shows the function template, and several examples runs of the function (you must show all the examples with these values in your submission): Template def printIndex(lst): replace with your docstring newList = lst # ________________________ elementNum =…
- Python code Python Write a function named `freq(l)` that takes a list `l` of numbers and returns a tuple of the most frequent number and its frequency. For example, `freq([1,2,3,4,5,2,3,4,5,3,4,5,4,5,4]) returns (4,5) because number 4 appears 5 times in this list. If multiple numbers appear as most frequent, then the first element of the returned tuple is a list of all those numbers. For example, freq([1,2,3,1,2,1,2,3,1,2]) will return ([1,2], 4) because both 1 and 2 appear 4 times in the list. """ def freq(l): # remove the following line to solve this question returnAssume that L is a list of Boolean values, True and False. Write a program in python with a function longestFalse(L) which returns a tuple (start, end) representing the start and end indices of the longest run of False values in L. If there is a tie, then return the first such run. For example, if L is False False True False False False False True True False False 0 1 2 3 4 5 6 7 8 9 10 then the function would return (3, 6), since the longest run of False is from 3 to 6.#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.
- Write a Python function Salary_levels, that takes a list as an argument and returns the number of the high salaries (salary>=5000), the averagesalaries(1000<=salary<5000, and the low salaries (salary<1000).You can use the following list :salaries= [500,1070,1450,6500,9000,940,450,400,600,2750,1100,8400,1500,900,1200] Use the above function to print the counts of the high, average, and low salaries. include two screenshots that show the code and the output. note: the codes of parts a and b should be included in your answerWrite a function randomList() that gets three integers as parameters, start, bound and k. This function will create a list of k randomly generated integer numbers between start and bound values (both inclusive), and return the created list.Write a function sqrtList() that gets a list as parameter, print the numbers in the list and their square root. The square roots will be printed with 3 decimal digits. Write Python statements that ask the user to input start, bound and k values, then call the method to perform the calculations and produce the output.At the end print average of numbers by calling the function calculateAverage(). Part-2:Enter start: 10Enter end: 30Enter k: 41. number: 28 Square root = 5.2922. number: 22 Square root = 4.6903. number: 10 Square root = 3.1624. number: 16 Square root = 4.000Average of numbers is = 19.0Write a function randomList() that gets three integers as parameters, start, bound and k. This function will create a list of k randomly generated integer numbers between start and bound values (both inclusive), and return the created list.Write a function sqrtList() that gets a list as parameter, print the numbers in the list and their square root. The square roots will be printed with 3 decimal digits. Write Python statements that ask the user to input start, bound and k values, then call the method to perform the calculations and produce the output.At the end print average of numbers by calling the function calculateAverage().