python max function

 

 

About a .python max function

 

    max function returns the maximum value of a given parameter, the parameter sequence may Syntax:

max( x, y, z, .... )

    Return Value: returns the largest value parameter;

 

Function uses two .python max

! # Usr / bin / env Python 
# - * - Coding: UTF- 8 _ * -
 "" "
 @author: Why grief 
@Blog (personal blog address): shuopython.com 
@WeChat Official the Account (micro-channel public number): Ape He said Python 
@Github: www.github.com 
 
@file: python_max.py 
@time: 2020 / 03 / 15  23 : 35 
 
@Motto: short step a thousand miles, no small streams into a mighty torrent, wonderful life program ! need to accumulate persistently 
"" "
  
# max supports two or more parameters, and returns the maximum 
Print (max ( . 1 , . 5 )) 
Print (max ( 5.5 , 6100 , . 1 , - 10 , 20 is ))

 

Output:

Note: max function type only or float int type, other types will be given , for example:

print(max(1,'a'))
 
TypeError: '>' not supported between instances of 'str' and 'int'

 

 

 

 

 

you may also like:

    1.python local and global variables

    2.python variable types immutable type

    3.python deep copy and shallow copy

 

    Reproduced please specify: ape say Python  »  Python max function

 

Technical exchanges, business cooperation please contact bloggers
Scan code or search: ape say python
No public python tutorial
Ape say python
No. sweep the micro-channel public concern

Guess you like

Origin www.cnblogs.com/shuopython/p/12522245.html