Skip to main content
Commonmark migration
Source Link

Python 3, 1 task, 268 bytes, non-competitive

##Python 3, 1 task, 268 bytes, non-competitive II tried Task #2 in Python 3.5.2 I am new to code golfing and python

import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

##Python 3, 1 task, 268 bytes, non-competitive I tried Task #2 in Python 3.5.2 I am new to code golfing and python

import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

Python 3, 1 task, 268 bytes, non-competitive

I tried Task #2 in Python 3.5.2 I am new to code golfing and python

import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]
Included number of tasks in header, removed comments (which weren't included in the bytecount anyway), tagged as non-competitive due to challenge rules on source length
Source Link
The Fifth Marshal
  • 6.3k
  • 1
  • 25
  • 44

##Python 3, 1 task, 268 bytes, non-competitive I tried Task #2 in Python 3.5.2 I am new to code golfing and python

#task2
# Input: string of 7 numbers
# Output: closest number to 1 000 000 with that digts
# N = 1,000,000
import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

##Python 3, 268 bytes I tried Task #2 in Python 3.5.2 I am new to code golfing and python

#task2
# Input: string of 7 numbers
# Output: closest number to 1 000 000 with that digts
# N = 1,000,000
import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

##Python 3, 1 task, 268 bytes, non-competitive I tried Task #2 in Python 3.5.2 I am new to code golfing and python

import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

I##Python 3, 268 bytes I tried Task #2 in Python 3.5.2 I am new to code golfing and python

#task2
# Input: string of 7 numbers
# Output: closest number to 1 000 000 with that digts
# N = 1,000,000
import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

I tried Task #2 in Python 3.5.2 I am new to code golfing and python

#task2
# Input: string of 7 numbers
# Output: closest number to 1 000 000 with that digts
# N = 1,000,000
import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]

##Python 3, 268 bytes I tried Task #2 in Python 3.5.2 I am new to code golfing and python

#task2
# Input: string of 7 numbers
# Output: closest number to 1 000 000 with that digts
# N = 1,000,000
import itertools
def f2(l):
    n=1000000
    l=list(itertools.permutations(l))
    j = len(l)
    m=[None]*j
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
        l[j]=abs(n-m[j])
    l.sort()
    k=n-l[0]
    return(n+l[0],k)[k in m]
Source Link
Loading