Find maximum of given integer values

Problem Statement

Given a list or sequence of integer values via the standard input, find the maximum value.

Input

The first line of input contains a sequence of integer values separated by space.

Output

Print the maximum of given integer values.

As is

The boilerplate code is already there to read a sequence of integer values via input from user, in the main() function. Also it calls the maximum_of_values() function, and prints the returned value. Do not edit this code.

To do ✍

maximum_of_values() has one parameter: nums which is a list of integer values. Write code inside the function body to compute the maximum of given integer values in the list, and return the maximum value.

Example 1

Test input

4 8 6 1 0 7 3 0 -8

Test output

8

Explanation

8 is the maximum of given integer values.

Useful References

Python Program

# Complete the following function
# Return the maximum of given integers in nums
def maximum_of_values(nums):




# Boilerplate code - Do not edit the following
def main():
    nums = [int(x) for x in input().split()]
    print(maximum_of_values(nums))

if __name__ == "__main__":
    main()

Test case 1

0
0

Test case 2

8 421 0 3 9 2 541 62 210 7
541

Test case 3

87 5 4 22 369 -7 21 -963 821 0
821

Test case 4

-7 -963
-7
# Complete the following function
# Return the maximum of given integers in nums
def maximum_of_values(nums):
    return max(nums)

# Boilerplate code - Do not edit the following
def main():
    nums = [int(x) for x in input().split()]
    print(maximum_of_values(nums))

if __name__ == "__main__":
    main()
show answer
main.py
⏵︎ Run Tests
Reset
Download
×
Code copied to clipboard successfully 👍