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

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:

主站蜘蛛池模板: 繁昌县| 惠州市| 阜新| 昆明市| 蓬溪县| 东城区| 南丰县| 韶山市| 康马县| 盐津县| 太白县| 钦州市| 安仁县| 巴南区| 忻城县| 沾化县| 忻城县| 濮阳县| 洞头县| 敦煌市| 武威市| 江油市| 宿州市| 手机| 巩留县| 北流市| 东阳市| 犍为县| 丰台区| 溧阳市| 万源市| 四子王旗| 陇南市| 镶黄旗| 伊宁县| 巢湖市| 天峨县| 临泽县| 右玉县| 信宜市| 石楼县|