Check Digit Calculator & GTIN-8 Validator
The doMaths function has no clear purpose — hence its weird name.  It acts as both to calculate the expected last digit of a 7-digit input and to validate the last digit of an 8-digit input.  Furthermore, it prints its results instead of returning them, hindering reuse of the function.

What you really want to do is share the code that calculates total.  You could write a function like this, using slices:

def gtin8_checksum_digit(number):
    """
    Given a 7- or 8-digit string, calculate the expected GTIN-8 checksum.

    &gt;&gt;&gt; gtin8_checksum_digit('3141592')
    '7'
    &gt;&gt;&gt; gtin8_checksum_digit('31415927')
    '7'
    """
    total = sum(3 * int(d) for d in number[0:7:2]) + \
            sum(int(d) for d in number[1:6:2])
    return str(10 - (total % 10))


No floating-point arithmetic should be necessary.

Note the docstring, and in particular, the doctests that make it clear how the function behaves.

To use that function…

if __name__ == '__main__':
    while True:
        try:
            number = input("Enter a 7 or 8 digit number for testing: ")
            int(number)    # Trigger possible ValueError
            if 7 &lt;= len(number) &lt;= 8: break
            print("Length of number must be 7 or 8")
        except ValueError:
            print("Only enter numbers.")
    if len(number) == 8:
        print("Valid" if gtin8_checksum_digit(number) == number[7] else "Invalid")
    else:
        print(gtin8_checksum_digit(number))