Skip to content

Commit

Permalink
add random shuffle python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sato-makoto committed Dec 11, 2021
1 parent 8b4adc9 commit 8b39ae2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python3/hana.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
import random
import sys

list = [x for x in sys.argv[1]]
random.shuffle(list)
print(''.join([x for x in list]))
12 changes: 12 additions & 0 deletions python3/hana2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
# shuffle and print argv[1]
from sys import argv
from random import shuffle

print("from:", argv[1])
mystr = list(argv[1])
shuffle(mystr)
print("to: ", sep=" ", end="")
for x in mystr:
print(x, sep="", end="")
print("")

0 comments on commit 8b39ae2

Please sign in to comment.