Home > Article > Backend Development > How to output the maximum value when inputting ten numbers in python
How to input ten numbers in python and output the maximum value: 1. If it is an integer, use the function [a, b, c = map(int, input().split())]; 2. Use Function [X=input().split()].
Related free learning recommendations: python video tutorial
How to input ten numbers in python and output the maximum value:
First method:
If you have limited input For integers, you can use the following function:
a, b, c = map(int, input().split())
1. Enter a number directly m = int(input())
2. Entering two numbers is m, n = map(int, input().split())
3. Three or more numbers are Similar to the two:
a, b, c = map(int, input().split())
a, b, c, d = map(int, input( ).split())
Because when using this function, you must give it in front of how many numbers you want to enter. Corresponding number parameters, so it will be more inconvenient when you want to input a large number of integers
Second type:
X=input().split()
This method is the most concise, clear and convenient. Compared with the first method, you can enter any integer without any restrictions.
Third method:
This method is mainly used to determine the largest number in a string, even if there are other characters such as spaces or commas.
The above is the detailed content of How to output the maximum value when inputting ten numbers in python. For more information, please follow other related articles on the PHP Chinese website!