如何使用正确的python语法回答这个foor循环问题:
def int_all_2(str_list):
'''(list of str) -> NoneType
Replace every str element of str_list with its corresponding
int version.
For example,
>>> sl = ['100', '222', '2', '34']
>>> in
我需要在列表的给定列中找到一个最大的元素:
myList = [(1,2,0), (3,5,8), (9,1,2)]
如下所示:
max(myList(:,2)) // maximal element in the 2nd column
在本例中,答案应该是5。
我写了下面的代码,但是如何将第一列或第二列放入"max“的输入中呢?
fun findSum(myList:MyList) = max(#1 myList) + max(#2 myList)
fun max [] = 0
| max (x::xs) = foldl Int.max x xs
谢谢。
def entree_liste():
liste_entier = []
liste_nombre = int(input("Enter list of number separate by space :"))
for chiffre in range(liste_nombre):
liste_entier.append(chiffre)
print(liste_entier)
我的错误
liste_nombre = int(input("Enter list of number separate by space :