标签:play max 技术 closed one 包含 2.3 最小 lam
数学运算(7):
1 print(abs(-5)) # 5 2 3 print(divmod(7,2)) # (3, 1) 4 5 print(round(7/3,2)) # 2.33 6 print(round(7/3)) # 2 7 print(round(3.32567,3)) # 3.326 8 9 print(pow(2,3)) # 两个参数为2**3次幂 10 print(pow(2,3,3)) # 三个参数为2**3次幂,对3取余。
1 print(sum([1,2,3])) 2 #6 3 print(sum((1,2,3),100)) 4 #106 5 print(sum([1,2,3],100)) 6 #106 7 print(min([1,2,-5,],key=abs)) 8 #1 9 dic = {‘a‘:3,‘b‘:2,‘c‘:1} 10 print(min(dic,key=lambda x:dic[x])) 11 #c 12 print(max([1,2,3],key=abs)) 13 #3 14 print(max([1,2,-6],key=abs)) 15 #-6 16 dic = {‘a‘:3,‘b‘:2,‘c‘:1} 17 print(max(dic,key=lambda x:dic[x])) 18 #a
标签:play max 技术 closed one 包含 2.3 最小 lam
原文地址:https://www.cnblogs.com/zhaojingyu/p/8955237.html