Created
February 6, 2023 13:28
-
-
Save Denenberg/6a0ab87afc63382d6b1b3accce366808 to your computer and use it in GitHub Desktop.
Here's a simple program that prints the product of the digits of M^N for all M and N in the given range:
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
# Here's a simple program that prints the product | |
# of the digits of M^N for all M and N in the given range: | |
def product_of_digits(n): | |
result = 1 | |
while n > 0: | |
result *= n % 10 | |
n //= 10 | |
return result | |
for m in range(2, 10): | |
for n in range(2, 10): | |
print (m, n, product_of_digits(m**n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment