업데이트 '3-3'

This commit is contained in:
kim_yubin 2018-11-11 14:41:01 +09:00
parent 6420dc6114
commit c879dd5d31
2 changed files with 29 additions and 28 deletions

29
3-3 Normal file
View File

@ -0,0 +1,29 @@
import random
gen=[]
result=[] ##[차,[b],[b+1]]
t=0
u=0
v=0
while v<8:
r=random.randint(1,20)
gen.append(r)
v+=1
gen.sort()
comp=gen[1]-gen[0]
for a in range(1, len(gen)):
result.append([gen[a]-gen[a-1],gen[a-1],gen[a]])
print(result)
print("-------------------------------------------------")
for b in range(0, len(result)-1):
if comp>result[b][0]:
comp=result[b][0]
print(comp)
for c in range(0, len(result)-1):
if result[c][0] == comp:
print([result[c][1], result[c][2]])

View File

@ -1,28 +0,0 @@
import random
r = random.randint(1, 10)
s=[]
s.sort()
result=[]
t=0
x=1
while t<8:
s.append(r)
r=random.randint(1, 10)
t+=1
s.sort()
t=0
for a in s:
t+=x
while t<len(s):
k = abs(a-s[t])
result.append(k)
t+=1
x+=1
t=0
for j in result:
if k < j:
print('(' + str(a) + ', ' + str(s[t]) + ')')