Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rightDigits = [str(i) for i in range(10)]
- for n in range(2, 101):
- square = str(n**2)
- cube = str(n**3)
- digits = square + cube # Data type of "digits" is string
- digits = list(digits)
- if len(digits) == 10:
- # Now, my list "digits" contains all the digits from square and cube
- if sorted(digits) == rightDigits:
- print(n, n**2, n**3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement