Ad
Fundamentals
Code
Diff
  • def numberprint(x):
        l1 = [str(i) for i in range(1, x + 1)]
        l2 = [str(i) for i in range(x - 1, 0, -1)]
        l1 += l2
        return int("".join(l1))
    • def numberprint(x):
    • nor = 0
    • final = ''
    • while nor < x:
    • nor += 1
    • final += str(nor)
    • while nor > 1:
    • nor -= 1
    • final += str(nor)
    • return int(final)
    • l1 = [str(i) for i in range(1, x + 1)]
    • l2 = [str(i) for i in range(x - 1, 0, -1)]
    • l1 += l2
    • return int("".join(l1))