How do I make a python function that takes 5 user inputs then sorts that from largest to smallest, smallest to largest, adds them and an average.
lst = []
print("Enter 5 numbers")
for i in range(5):
lst.append(int(input()))
lst.sort()
print("sorts that from largest to smallest:",lst)
lst.sort(reverse=True)
print("sorts that from smallest to largest:",lst)
print("Sum =",sum(lst))
print("Average =",(sum(lst)/len(lst)))


How do I make a python function that takes 5 user inputs then sorts that from...
Write a program that inputs ten (10) integers and then sorts them in order from largest to smallest in the programming language called Perl. You do not need to error check the input; you can assume the user enters integers. You can select the sorting algorithm of your choice, but you must implement this algorithm yourself. You cannot use a built-in sorting function. [15 points] Below is an example of a sample program run: Unsorted: 10, 4, 23, 99, 7,...
Using python, Write a function that takes 3 inputs, x, y, and z, but make y and z default parameters, with initial values of 5 and 12. Have the function return the sum of x, y, and z
Write a PYTHON program that reads in three strings and sorts them lexicographically. Do NOT user the sort function. Enter string 1: Charlie Enter string 2: Able Enter string 3: Baker Able Baker Charlie Your code with comments A screenshot of the execution Test Cases: Able, Baker, Charlie Baker, Charlie, Able Charlie, Able, Baker Able, Charlie, Baker Baker, Able, Charlie Charlie, Baker, Able
Write a program in PYTHON that takes a string and an integer as inputs from the user, and then prints a new string that contains the letters from the original string “rotated” by the given amount. For example, “cheer” rotated by 7 places gives the word “jolly” and “melon” rotated by -10 gives the word “cubed.” Use built-in function: ord() to convert a character to a numeric code and chr() to convert numeric code to character.
In Python 3 - Write a program that reads a sequence of integer inputs from the user. When the user is finished entering the integers, they will enter a 'q'. There is no need to check if the entry is a valid integer. All integers in the test data (input) will be between -255 and 255. The program should then print: The smallest and largest of the inputs. The number of even and odd inputs (0 should be considered even)...
Write a Unix shell script that takes three integers and sorts them from largest to smallest. An example execution is as follows (assume the name of the script is shs): % shs 3 9 4 The order is: 9 4 3 % shs -1 0 3 The order is: 0 -1 -3
Please write a python function for :
greedy: This function takes two inputs: one a graph, and the other an ordering of the vertices as a list, and returns the proper vertex-coloring produced by the greedy algorithm over the ordering in the list. Examples: greedy({"A" : ["B", "C"], "B" : ["A"], "C" : ["A"]},[“A”, “B”, “C”]) should return {“A” : 1, “B” : 2, "C" : 2} greedy({“A” : ["B"], "B" : [“A”, “C”],"C" : [“B”, “D”), “D" : ["C"]},[“A”,...
How do I write a one-line (excluding function definition) python function make_filter(limit), which takes in an integer limit, and returns a function that takes in a list of strings, and returns a copy of the list with all strings shorter than limit characters removed. make_filter must be exactly one line of Python code, not including the function signature line ( def make_filter(limit): ) example: >>> filter5 = make_filter(5) >>> filter5(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa']) ['aaaaa', 'aaaaaa'] >>> filter2...
Python Script format please!
1. Write a script that takes in three integer numbers from the
user, calculates, and displays the sum, average, product, smallest,
and largest of the numbers input. Important things to note: a. You
cannot use the min() or max() functions, you must provide the logic
yourself b. The calculated average must be displayed as an integer
value (ex. If the sum of the three values is 7, the average
displayed should be 2, not 2.3333). Example:...
#Python 1.Write a function called difference() that accepts a list of numbers from the user and returns the difference between the largest and the smallest numbers in the list as follows: >>> difference() Please enter a list: [100, 102, 106, -10] 116 >>> difference() Please enter a list: [1,2,3,4,5,6,7,8,9,10] 9 >>>