Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
two-digits-puzzle
#numbers go here n = [1,5,10,16,17,74,77,79,87] #letters go here, leave blank '' if there are no letters l = 'G7f2WKxaR' #amount of numbers count = len(n) #sums of all combination in form [sum,1st,2nd] sums = [[n[i]+n[j], i, j] for i in range(count) for j in range(i+1,count)] #filter sums where there are 2 of the same and split in 3 lists [sum],[1st],[2nd] a,b,c = map(list,zip(*[sums[i] for i in range(len(sums)) if [x[0] for x in sums].count(sums[i][0])==2])) #if there are letters if l: #combine all letters, except those in [1st]+[2nd] result = ''.join([l[i] for i in range(count) if i not in b+c]) #if there are no letters given else: #combine all letters converted from numbers, except those in [1st]+[2nd] result = ''.join([chr(n[i]) for i in range(count) if i not in b+c]) print('https://www.steamgifts.com/giveaway/'+result+'/') #sum that we found print('Sum: '+str(a[0]))
run
|
edit
|
history
|
help
0
Lab_I_4_25_11_2020
floating point limitations
aaa
EJ_2_python_20.068.214-9_20.116.927-5
Itc
L5- part b
jhjhh
Linear search
Test
Counting