Menu

gitpiper

digitize python Code Snippet in 2024

mathlistbeginner

Last Updated: 10 April 2024

Converts a number to a list of digits.

  • Use map() combined with int on the string representation of n and return a list from the result.
def digitize(n): return list(map(int, str(n)))
digitize(123) # [1, 2, 3]

python snippet similar to digitize For You in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️