Created
December 19, 2023 14:05
-
-
Save shorodilov/0bcbe27b4387c0891011d41d1354c2cd to your computer and use it in GitHub Desktop.
The multipliers of the number's digits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script will ask the user for an integer number and print out its | |
multipliers | |
""" | |
# collect data | |
number = int(input("Enter a number: ")) | |
# cast the user's input to a string and print back the multipliers | |
for power_of_10, multiplier in enumerate(str(number)[::-1]): | |
print(f"{multiplier} x {10 ** power_of_10}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be modified to more straight-forward approach, while the beginner pythonistas can struggle with reversing the list.