sanchuan555
发表于 2020-12-15 21:09:12
def min_n(num):
import random as r
listR=[]
listRN=[]
for i in range(num):
listR.append(r.randint(0,100))
print(listR)
for n in listR:
for m in listR:
if n==m:
pass
else:
listRN.append(abs(n-m))
print(listRN)
sqe=sorted(listRN)
print(sqe)
print(sqe)
min_n(4)
海里虾
发表于 2021-1-4 21:24:36
list1 =
list2 = []
for i in list1:
for j in list1:
if i == j:
continue
else:
list2.append(abs(i-j))
print(min(list2))
sun8061
发表于 2021-1-6 09:55:37
python每日必看
一块钱赫赫
发表于 2021-3-13 20:35:58
def foo(data1,data2):
min=abs(data1-data2)
for i in data1:
for j in data2:
if abs(i-j)<min:
min=abs(i-j)
return min
a=
b=
c=foo(a,b)
print(c)