Skip to content

Instantly share code, notes, and snippets.

@sxslex
Last active May 24, 2017 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sxslex/713ca127b781994eb48d4f85204ccd43 to your computer and use it in GitHub Desktop.
Save sxslex/713ca127b781994eb48d4f85204ccd43 to your computer and use it in GitHub Desktop.
Decompoe um numero em sua representação decimal
# -*- coding: utf-8 -*-
def decompor_decimal(num):
"""Decompoe um numero em sua representação decimal. """
l = len(str(num))
return ' + '.join([i.ljust(l - b, '0') for b, i in enumerate(str(num))])
print(decompor_decimal(32477))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment