Find the number of daffodils between 100-999

Time:2021-10-26

The number of daffodils, that is, the cubic sum of a three digit number, ten and one hundred three digits is equal to the three digits.

 1 from math import pow
 2 
 3 if __name__ == "__main__":
 4     
 5     l = list()
 6     for x in range(100, 1000):
 7         x1, x2, x3 = str(x)
 8         if pow(int(x1), 3) + pow(int(x2), 3) + pow(int(x3), 3) == x:
 9             l.append(x)
10     print(l)

 

Recommended Today

SQL exercise 20 – Modeling & Reporting

This blog is used to review and sort out the common topic modeling architecture, analysis oriented architecture and integration topic reports in data warehouse. I have uploaded these reports to GitHub. If you are interested, you can have a lookAddress:https://github.com/nino-laiqiu/TiTanI recorded a relatively complete development process in my hexo blog deployed on GitHub. You can […]