In this example we will show how to output daffodils numbers using Python.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
print('Daffodils-Numbers:')
for i in range(1,10):
for j in range(0,10):
for k in range(0,10):
if i*i*i+j*j*j+k*k*k==i*100+j*10+k:
print(i,j,k)
Output:
Daffodils-Numbers:
1 5 3
3 7 0
3 7 1
4 0 7