min max abs
Python provides a big list of built-in functions that make performing many operations way easier.
input()are great examples of such built-in functions. When dealing with computations, in many cases it’s required to compute
maxvalues among several values. To help with those operations python provides built-in functions
abs()to compute the minimum, maximum, and the absolute value correspondingly.
# max() examples print(max(10, 17, 12)) # 17 a = max(0, -8) # 0 # min() examples print(min(11, 10, 2, -7, 0)) # -7 print(min(3, a, -1)) # -1 # abs() examples print(abs(-10)) # 10 print(abs(10)) # 10 x = -2 x = abs(x) print(x) # 2
abs()takes only a single value and computes the absolute value for only 1 item, while
max()operate with an arbitrary number of values.
maxa single value. What will happen? Why?
Given 4 floating-point numbers in the input, compute their minimum and maximum and print the values in the output side by side. The next 4 lines should contain the absolute values for all the inputted numbers.
0 3.3 4 -2.3
-2.3 4 0 3.3 4 2.3
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB