[英]Python: max & min functions
I really don't understand the max or min functions, the meaning of them.我真的不明白 max 或 min 函数,它们的含义。 For instance, when i write these in the notepad++, in the output i see a letter of the word.
例如,当我在记事本++中写下这些时,在输出中我看到了一个单词的字母。 And i can't understand it.
我无法理解。 Why only this letter, not another letters of this word?
为什么只有这个字母,而不是这个词的其他字母? Please, help me on this way.
请帮我走这条路。 Thanks
谢谢
In the Notepad++在记事本++中
In the Output在输出中
o ○
W宽
As per the ASCII table根据 ASCII 表
so, max value = o (decimal 111) min value = W (decimal 87)所以,最大值 = o(十进制 111) 最小值 = W(十进制 87)
To find out why, you can map
ord
over the strings:要找出原因,您可以
map
ord
map
到字符串上:
>>> list(map(ord, "Hello Home"))
[72, 101, 108, 108, 111, 32, 72, 111, 109, 101]
The highest number in there is 111, which corresponds to "o" (the ASCII value of "o" is 111).其中最大的数字是 111,对应于“o”(“o”的 ASCII 值是 111)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.