我正在尝试研究这个简单的操作,而我却没有为它做任何事情.我希望能够找到一个整数的位置值,我想知道是否有特定的宝石或操作.例如:
a = 1651684651
p find_place_value_of(a,5) # imaginary function to return the value of the
# number in the 10000 column
# output should be 8
Run Code Online (Sandbox Code Playgroud)
到目前为止,我能做的最好的事情是想出这个丑陋的小功能:
j= 262322
a= j
a/=100000
b= j - a*100000
b/=10000
c= j - a*100000 - b*10000
c/=1000
d= j - a*100000 - b*10000 - c*1000
d/=100
e= j - a*100000 - b*10000 - c*1000 - d*100
e/=10
f= j - a*100000 - b*10000 - c*1000 - d*100 - e*10
p a,b,c,d,e,f,j
Run Code Online (Sandbox Code Playgroud)
是否有更优雅的方式来寻找地方价值?