Skip to content

Full test 4! #2

Description

@GAMAURER

import random
def permute(xs, low=0):
if low + 1 >= len(xs):
yield xs
else:
for p in permute(xs, low + 1):
yield p
for i in range(low + 1, len(xs)):
xs[low], xs[i] = xs[i], xs[low]
for p in permute(xs, low + 1):
yield p
xs[low], xs[i] = xs[i], xs[low]

def item():
return int(random.randint(1,6))+int(random.randint(1,4)*10)+int(random.randint(1,4)*100)
for p in permute([1, 2, 3, 4]):

for i in p: 
    print(p[i-1])
    print(item())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions