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

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:

主站蜘蛛池模板: 武胜县| 宣威市| 梅州市| 兰考县| 乌苏市| 陈巴尔虎旗| 汽车| 敦化市| 涿鹿县| 沁源县| 崇州市| 寻甸| 长沙县| 江油市| 个旧市| 黑龙江省| 资兴市| 县级市| 临夏县| 昌黎县| 南部县| 永定县| 五大连池市| 新邵县| 濉溪县| 桃源县| 屏南县| 应用必备| 忻州市| 九龙县| 沛县| 吉木萨尔县| 肥乡县| 当雄县| 保康县| 乡城县| 五寨县| 栾川县| 屯门区| 兴化市| 都匀市|