For this exercise
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers.
For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))
I wrote:
num_float = int(input())
list_float = []
for i in range(num_float):
num = input()
list_float.append(num)
max_value = max(list_float)
for i in range(num_float):
list_float[i] = float(list_float[i]) / float(max_value)
print('{:.2f}'.format(list_float[i]))
everything appears working fine, but for the 'max_value', the system is always picking the last number of the list instead the greater number in it. I thought that by using max() would do that automatically.Thank you!
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- Description Xiao Zhang is often distressed because there are too many things to arrange. Now he has n tasks at hand, and each task has a starting times, and an ending time e;. To complete a task, he must do it from the starting time to the ending time, and Xiao Zhang can only perform one task at the same time. Xiao Zhang wants to know how many tasks he can accomplish at most. Input The first line is an integer n (1sns300000), indicating the number of tasks Xiao Zhang has at hand. In the next n lines, each line contains two integers s₁, e¡ (1≤s;arrow_forwardIn computer animation, a "jiffy" is commonly defined as 1/100th of a second. Define a function named jiffies_to_seconds that takes the number of "jiffies" as a parameter, and returns the number of seconds. Then, write a main program that reads the number of jiffies (float) as an input, calls function jiffies_to_seconds() with the input as argument, and outputs the number of seconds. Output each floating-point value with three digits after the decimal point, which can be achieved as follows: print (f'{your_value:.3f}') Ex: If the input is: 15.25 the output is: 0.152 The program must define and call the following function: def jiffies_to_seconds (user_jiffies) 461710.3116374.qx3zqy7 LAB ACTIVITY 7.11.1: LAB: A jiffy 1 # Define your function here 12345 3 if __name__ main.py == '__main__': # Type your code here. Your code must call the function. 0/10 Load default template...arrow_forwardPython code Screenshot and output is mustarrow_forwardOn Thursday, November 4, 2021, Big Man Games wrote: Computer programs are great at computing mathematical formulas. Once the formula is properly encoded you can use the code as much as you want without reprogramming it and you can share it with non-programmers without any trouble. This lab is an example of such a formula. Once you program it you won’t have to worry about the area of a circle again. Write and test a program that computes the area of a circle. This program should request a number representing a radius as input from the user. Use the formula 3.14 × radius2 to compute the area. Tip: There are a couple of ways to code an exponent. Look in the Operators unit for help (and you can’t use an x for multiplication). Tip: You will need to use the float data type to compute the remainder. The output should explain the results. Don’t just print a number. Tip: For your print statement you will need to use the comma, “,”, or plus, “+” symbols to stitch your output together. (“The…arrow_forwardDesign an algorithm for a problem that processes results of a swimming competition. The program will set a number of competitors, obtain their names from the user, and uses random number generator to get the results (in seconds, as real numbers with three digits after the decimal point). Then it will find and display the average timefor all competitors, andthe names and best three results (first, second, and third places). 1. Set a number of competitors as a constant TOTAL (no more than 10) 2. Declare two arrays to hold names and results (an actual array should have different name than the formal array in the function definitions) 3. Call functions to fill the arrays with names (user entries) and results (random decimal numbers) 4. Print all names and results as a table with appropriate titles 5. Display the average time (by calling function getAverage()) 6. Sort the array of results and corresponding names 7. Print names and results for the first three places (first…arrow_forwardDescription A mathmatician Goldbach's conjecture: any even number(larger than 2) can divide into two prime number’s sum.But some even numbers can divide into many pairs of two prime numbers’ sum. Example:10 =3+7, 10=5+5, 10 can divide into two pairs of two prime number. Input Input consist a positive even number n(4<=n<=32766). Output Print the value of how many pairs are this even number can be divided into. Sample Input 1 1234 Sample Output 1 25arrow_forwardarrow_back_iosarrow_forward_ios
- 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