Posts Tagged ‘Application’

Python Project

December 12, 2018 Leave a comment

Python: Armstrong Numbers

Check for Armstrong number in a range

In our last post (Check if a Number is Armstrong) we wrote a codes to check a given number and see whether it is an Armstrong or Not.

Today, we want to go through a set of numbers and see how many Armstrong numbers are there.

Before calling the ‘armstrong_in_range()’ and just to keep the code as less as we can, I assume the two numbers has the same number of digits, also I am getting the power (p) and the range numbers (n1, n2) out-side of this function and passing all as variables.

def armstrong_in_range(p,n1,n2):

my_sum = 0

count = 0

for num in range (n1,n2):


for arm in range(p):

my_sum = my_sum + ((num % 10)**p)

num = num // 10

if my_sum == tot:

print(‘\nThe number {} is Armstrong.’.format(tot))


count = count +1



print(‘\nWe have {} armstrong number(s)’.format(count))

Follow me on Twitter..


Python Project

November 23, 2018 Leave a comment

Python Project:

Two months back I start to learn #Python “Python is a #computer #programming #language “, you can say it grabbed me very quickly. I start to read some #sample #code from the net, then downloading the requirement and after 10 working days I was writing #codes in python and doing what I love Solving #mathematics puzzles with #python’.

So I decide to contribute in training or publishing python language by posting some codes block with explaining and comments, also by developing an application so we will learn on a real example.

I am publishing some codes on my Twitter (@h_ta3kees):

and I will do the same here on my blog.

The coming posts will be about the application that we will start develop I will call it ‘Expenditure App’.