如果我给 n=5。答案应该是 10000 到 99999。如果 n=2 那么答案应该是 10 到 99。怎么做?
I would use a Range
to generate this numbers:
(10**n...10**(n+1)).to_a
#=> [100, 101, 102, 103, ... 998, 999]
A Range with three dots ...
excludes the end value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.