Create a function that takes a number and returns an array of strings containing the number cut off at each digit.
Examples
420should return["4", "42", "420"]2017should return["2", "20", "201", "2017"]2010should return["2", "20", "201", "2010"]4020should return["4", "40", "402", "4020"]80200should return["8", "80", "802", "8020", "80200"]
PS: The input is guaranteed to be an integer in the range [0, 1000000]
def create_array_of_tiers(n):
passdef create_array_of_tiers(n):
return [str(n)[:e+1] for e,i in enumerate(str(n))]