Skip to content

Commit

Permalink
add 4div_list.py3
Browse files Browse the repository at this point in the history
  • Loading branch information
sato-makoto committed Jun 13, 2017
0 parents commit 0f422ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 4div_list.py3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from sys import argv

# 12345678 => [12, 34, 56, 78]

arg = int(argv[1])
print(arg)

def fourth_list(num):
mylist = [0,0,0,0]
if num < 100:
mylist[3] = num
elif num < 100**2:
mylist[2] = num // 100
mylist[3] = num % 100
elif num < 100**3:
mylist[1] = num // 100**2
mylist[2] = num % 100**2 // 100
mylist[3] = num % 100**2 % 100
else:
mylist[0] = num // 100**3
mylist[1] = num % 100**3 // 100**2
mylist[2] = num % 100**3 % 100**2 // 100
mylist[3] = num % 100**3 % 100**2 % 100
return mylist

if arg < 100**4:
print(fourth_list(arg))
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my python test scripts

0 comments on commit 0f422ea

Please sign in to comment.