In a
Modularity – Your program should have at least these two functions:
main – should accept input of a series of 10 integers from the user and an integer n that will be the search number. main should call the function display_larger and pass 2 arguments: the 10 integers stored in a list, and the number n.
display_larger – should accept the 2 parameters from main. Using a loop, the function should compare all numbers in the list of number from the user to n. If the number is larger than n, it should be stored in a second list containing only the numbers that are greater than n. A third list with those less than n should also be made and printed out. The lists should be sorted and then printed, as well. Sorted lists should be done in ascending order and then is descending order.
This function should display: The original list, n, and the list of numbers greater than n.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- Launch Meeting - Zoc X S Launch Meeting Zoc X Is Everyone Really Equ x E Reading Response 6 OCh7: Oppression & Se x SThank you for downlc X s.ucsc.edu/courses/46018/assignments/294537 2. are_anagrams This function takes two strings and returns True if they are anagrams of one another, which is to say that they contain the same letters, possibly rearranged, ignoring spaces and case. You can assume that the two input strings contain only letters and spaces. Sample calls should look like this: >>> are_anagrams ("bimmy is my friend", "My Bird Fey Minims") True >>> are_anagrams ("bimmy is my friend", "hello everyone") False >>> are_anagrams ("internet anagram server", "I rearrangement servant") True >>> are_anagrams ("internet anagram server", "internet anagram server") True 3. find_movies_by_director 4:11 PM This function takes a list of tuples (representing movies) and a string (representing a name of a director) and returns a 65°F Sunny 11/2/2021 e searcharrow_forwardin python create a function that raises a keyerror if the key is duplicatedarrow_forwardComplete the function that calculates the sum of the first n+1 terms of the geometric series a, ar, ar² ar³, arª ….. arn Note that the series begins with a and the last term is ar", in total there are n+1 terms. 1: # complete the function given the #variables a,r,n and return the value as series_sum. def sum geometric_series(a,r,n): # YOUR CODE HERE return series_sum print (sum_geometric_series (4.0, 5, 10))arrow_forward
- numpy.ipynb 1. addToArray(i) def addToArray(i): # TO DO %time addToArr(10) 2. a function def findDriver(distanceArr, driversArr, customerArr): result = '' ### put your code here return result print(findDriver(locations, drivers, cust)) # this should return Clara 3. The Amazing 5D Music example array([[ 1, 3, -2, -4, -1], [ 0, -1, 1, -1, -2], [ 2, 3, -2, -3, -1], [ 1, -1, 0, -1, -3], [-2, -1, 1, -1, -3], [ 1, 3, -1, -2, -3]]) ``` # TODO array([11, 5, 11, 6, 8, 10]) # TODO array([1, 3, 4, 5, 0, 2]) # TODO # TODO def findClosest(customers, customerNames, x): # TO DO return '' print(findClosest(customers, customerNames, mikaela)) # Should print Ben print(findClosest(customers, customerNames, brandon)) # Should print Ann 4. Numpy drones arr = np.array([-1, 2, -3, 4]) arr2 = np.square(arr) arr2 locations = np.array([[4, 5], [6, 6], [3, 1], [9,5]]) drones = np.array(["wing_1a", "wing_2a",…arrow_forwardPlease design another function called: multiply_up (int n), which will multiple up from 1 to n, like 1*2*3*4*5....*n, and return the result.arrow_forwardJS Write a function named count_in_range that takes a list/array of decimal numbers as a parameter. The function must return the number of entries in the parameter whose value is between 16.67 and 47.61. Your count should NOT include any entries whose value is equal to 16.67 or 47.61.arrow_forward
- Customized step counter Learning Objectives In this lab, you will Create a function to match the specifications Use floating-point value division Instructions A pedometer treats walking 2,000 steps as walking 1 mile. It assumes that one step is a bit over 18 inches (1 mile = 36630 inches, so the pedometers assume that one step should be 18.315 inches). Let's customize this calculation to account for the size of our stride. Write a program whose input is the number of steps and the length of the step in inches, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print(f'{your_value:.2f}') Ex: If the input is: 5345 18.315 the output is: You walked 5345 steps which are about 2.67 miles. Your program must define and call the following function. The function should return the number of miles walked.def steps_to_miles(user_steps, step_length) # Define your function here if __name__…arrow_forwardDeclare a function named contains_char. Its purpose is when given two strings, the first of any length, the second a single character, it will return True if the single character of the second string is found at any index of the first string, and return False otherwise.arrow_forwardJupyter Notebook Fixed Income - Certicificate of Deposit (CD) - Compound Interest Schedule An interest-at-maturity CD earns interest at a compounding frequency, and pays principal plus all earned interest at maturity. Write a function, called CompoundInterestSchedule, that creates and returns a pandas DataFrame, where each row has: time (in years, an integer starting at 1), starting balance, interest earned, and ending balance, for an investment earning compoundedinterest. Use a for(or while) loop to create this table. The equation for theith year's ending balance is given by: Ei =Bi (1+r/f)f where: Ei is year i's ending balance Bi is year i's beginning balance (note: B1 is the amount of the initial investment (principal) r is the annual rate of interest (in decimal, e.g., 5% is .05) f is the number of times the interest rate compounds (times per year) The interest earned for a given year is Ei - Bi Note the term of the investment (in years) is not in the above equation; it is used…arrow_forward
- program5_1.py Part 1Write a program that displays a table of ten distance equivalents in miles and kilometers. See Example output. You must generate the table by running a function inside a loop in main. Generate a random integer from 10 to 60, inclusive, in each loop cycle. Use this latter value as the miles argument to the function. Repeat: The function prints the table. Print the miles in a column 5 characters wide with 2 decimals and the kilometers in a column 13 characters wide with 5 decimals. Use the column formatting concepts at the end of Chapter 2, not tabs or other methods not in this course. Please include your psudocode to explain your code. Example output MILES KILOMETERS 52.00 83.68568 11.00 17.70274 40.00 64.37360 21.00 33.79614 14.00 22.53076 23.00 37.01482 48.00 77.24832 22.00 35.40548 15.00 24.14010 16.00 25.74944 program5_2.py Part 2Write another program that generates another table with the same columns and decimals…arrow_forwardvowelIndex Write a function vowelIndex that accepts a word (a str) as an argument and returns the index of the first vowel in the word. If there is no vowel, -1 is returned. For this problem, both upper and lower case vowels count, and 'y' is not considered to be a vowel. Sample usage: >>> vowelIndex('hello') 1 >>> vowelIndex('string') 3 >>> vowelIndex('string') 3 >>> vowelIndex('BUY') 1 >>> vowelIndex('APPLE') 0 >>> vowelIndex('nymphly') -1 >>> vowelIndex('string')==3 True >>> vowel Index ('nymphly')==-1 Truearrow_forwardComplete the Funnyville High School registration program where user is prompted for her full name and the program generates email id and temporary password. Sample run: generate_EmailID: This function takes two arguments: the user’s first name and last name and creates and returns the email id as a string by using these rules: The email id is all lower case. email id is of the form “last.first@fhs.edu”. e.g. For "John Doe" it will be "doe.john@fhs.edu". See sample runs above. generate_Password: This function takes two arguments: the user’s first name and last name and generates and returns a temporary password as a string by using these rules. Assume that user's first and last names have at least 2 letters. The temporary password starts with the first 2 letters of the first name, made lower case. followed by a number which is the sum of the lengths of the first and last name (For example this number will be 7 for "John Doe" since length of "John" is 4 and length of "Doe" is…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education