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

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:

主站蜘蛛池模板: 商洛市| 贡嘎县| 托克托县| 合川市| 团风县| 泰宁县| 垣曲县| 湖北省| 临洮县| 东兴市| 镇坪县| 手游| 梅州市| 万源市| 四平市| 东乡族自治县| 海丰县| 凤庆县| 龙江县| 苏尼特右旗| 福安市| 奉贤区| 壤塘县| 江安县| 巩义市| 松溪县| 临漳县| 泗阳县| 南丹县| 会昌县| 明星| 蒲江县| 唐河县| 赤城县| 进贤县| 永兴县| 公主岭市| 鸡东县| 资源县| 抚松县| 永平县|