官术网_书友最值得收藏!

Replication with len(), max(), and min()

The multiplication operator *, when applied to lists, causes a replication effect of the list elements. The contents of the list are repeated as many times as indicated by the number passed to the replication operator:

The len() method gives the length of the Python lists. The max() method returns the maximum element of the list, while the min() method returns the minimum element of the list:

We can use the max and min methods on the character types as well, but we cannot use them on a list that has mixed or heterogeneous types. If we do this, we will get an exception stating that we are trying to compare numbers and characters:

主站蜘蛛池模板: 昂仁县| 山东| 略阳县| 金湖县| 新巴尔虎右旗| 芦溪县| 西安市| 嘉黎县| 宝山区| 于田县| 莒南县| 建宁县| 前郭尔| 沾化县| 威信县| 闸北区| 大冶市| 子洲县| 华安县| 华宁县| 林州市| 如东县| 铜陵市| 呼和浩特市| 景宁| 桃江县| 罗平县| 福海县| 镇巴县| 比如县| 东源县| 云梦县| 星子县| 手游| 青铜峡市| 高阳县| 布拖县| 岑溪市| 万安县| 家居| 浦城县|