Squaring an integer by repetitive addition I've written two functions:


is_integer(), which tries to get a positive or a negative integer as input and returns the same value.
square(), which takes this returned value as parameter and returns square of the same.


The code in square() uses a for-loop that squares the integer by 'repetitive addition.' Finally, the script prints out the square of the integer returned by square().

Please review my code, point out errors of any kind and make suggestions.

# Squares an integer by repetitive addition
# Uses a for-loop
def square(integer):
    result = 0

    for element in range(1, abs(integer)+1):
        result += abs(integer)
    return 'Square of ' + str(integer) + ' is ' + str(result)

# Makes sure the input is an integer
def is_integer():
    number = raw_input('Enter an integer: ')

    if number.isdigit():
        number = int(number)
        return number
    elif number[0] == '-' and number[1:].isdigit():
        number = int(number)
        return number       
    else:
        print '%r is not an integer' % number
        print 'To try again, press Enter key'
        print 'Otherwise, press Ctrl+C keys to abort'
        raw_input('&gt;&gt;&gt; ')

        return is_integer()

# Square() takes as parameter the value returned by is_digit()
# Print the result returned by square()
print square(is_integer())
Improving square

There are several bad practices in square:


Multiple calls to abs(integer) when it could be calculated just once and reused
Instead of range(1, x + 1) you could write range(x)
When you don't need to use the loop variable element for anything, a common convention is to name it _ instead
Converting integer and result to string is tedious. It would better to use a formatted string expression


Making the appropriate changes the method becomes:

def square(integer):
    result = 0
    abs_integer = abs(integer)

    for _ in range(abs_integer):
        result += abs_integer
    return 'Square of {} is {}'.format(integer, result)


Improving is_integer

In addition to what @Jamal already pointed out, the method has other problems too:


The way you check if the user input is numeric is overly tedious
Naming the input as "number" is not great, because it might be text


A better way to write it (also fixing the name and making it non-recursive):

def prompt_integer():
    while True:
        text = raw_input('Enter an integer: ')

        try:
            return int(text)
        except ValueError:
            print '%r is not an integer' % text
            print 'To try again, press Enter key'
            print 'Otherwise, press Ctrl+C keys to abort'
            raw_input('&gt;&gt;&gt; ')


Why Python 2.7 ?

You're using Python 2.7. 
Note that there are no more planned releases for Python 2.7 beyond 2015 June.
Consider migrating to Python 3, it's the future.