Determine whether three sides form a valid triangle, and classify the triangle This is a my first Python program, and whilst I am new to Python I would like to keep in good practice 

Below is a short program to work out what type a triangle is and if it makes a valid triangle

I have tried to use as little documention for this as possible to try and get used to how things work in Python so I can only imagine the mistakes I have made. However please do mention anything that should have be done better

# Determin if triangle is Scalene. Isosceles or equilateral
# Also works out if lengths can make a triangle

from decimal import *

getcontext().prec = 3
getcontext().rounding = ROUND_HALF_UP

#Needs to be divided to re-set decimal place I think
a = Decimal(input("Length of side a = ")) / 1
b = Decimal(input("Length of side b = ")) / 1
c = Decimal(input("Length of side c = ")) / 1

if a != b and b != c and a != c:
    print("This is a a Scalene triangle")
    triangle_type = 'Scalene'
elif a == b and c == b:
    print("This is an Equilateral triangle")
    triangle_type = 'Equilateral'
else:
    print("This is an Isosceles triangle")
    triangle_type = 'Isosceles'

def is_valid_triangle(a, b, c,triangle_type):
    if triangle_type == 'Equilateral':
        return True #all same lengths will be a valid triangle
    elif triangle_type == 'Isosceles' or triangle_type == 'Scalene':
        if a == b:
            return a + b &gt; c
        elif b == c:
            return b + c &gt; a
        elif a == c:
            return a + c &gt; b
        else: #This will be the scalene triangle
            return a + b &gt; c
    else:
        return False #Message is unclear as could be lengths are negitive or correct int type not used

print('Is this a valid triangle?', is_valid_triangle(a,b,c,triangle_type))
Add a __name__ == &quot;__main__&quot; guard, and move the logic into a function separate from the I/O:
def triangle_type(a, b, c):
    '''Return a string indicating the type of triangle
       (Equilateral, Isosceles, Scalene, Impossible)
    '''
    # implementation here...

def main():
    getcontext().prec = 3
    getcontext().rounding = ROUND_HALF_UP

    #Needs to be divided to re-set decimal place I think
    a = Decimal(input(&quot;Length of side a = &quot;)) / 1
    b = Decimal(input(&quot;Length of side b = &quot;)) / 1
    c = Decimal(input(&quot;Length of side c = &quot;)) / 1

    print(f&quot;This is a {triangle_type(a, b, c)} triangle&quot;)

if __name__ == &quot;__main__&quot;:
    main()

In the implementation, we can save a lot of &quot;or&quot; tests by sorting the lengths before we start:
a, b, c = sorted([a, b, c])

if a + b &lt;= c:
    # N.B. automatically catches a &lt; 0, since b &lt;= c
    return 'Impossible'
if a != b != c:
    return 'Scalene'
elif a == c:
    return 'Equilateral'
else:
    return 'Isosceles'


Modified code
def triangle_type(a, b, c):
    '''
    Return a string indicating the type of triangle
    (Equilateral, Isosceles, Scalene, Impossible)
    '''

    a, b, c = sorted([a, b, c])

    if a + b &lt;= c:
        return 'Impossible'
    if a != b != c:
        return 'Scalene'
    if a == c:
        return 'Equilateral'
    return 'Isosceles'
    
def main():
    a = input(&quot;Length of side a: &quot;)
    b = input(&quot;Length of side b: &quot;)
    c = input(&quot;Length of side c: &quot;)
    print(f&quot;({a}, {b}, {c}) is a {triangle_type(a, b, c)} triangle&quot;)

if __name__ == &quot;__main__&quot;:
    main()


Further improvement
Use the doctest module to write the tests:
def triangle_type(a, b, c):
    '''
    Return a string indicating the type of triangle
    (Equilateral, Isosceles, Scalene, Impossible)

    &gt;&gt;&gt; triangle_type(1, 1, 2)
    'Impossible'
    &gt;&gt;&gt; triangle_type(-1, -1, -1)
    'Impossible'
    &gt;&gt;&gt; triangle_type(1, 1.0, 1)
    'Equilateral'
    &gt;&gt;&gt; triangle_type(1, 2, 2)
    'Isosceles'
    &gt;&gt;&gt; triangle_type(2, 3, 2)
    'Isosceles'
    &gt;&gt;&gt; triangle_type(2, 3, 4)
    'Scalene'
    '''

    a, b, c = sorted([a, b, c])

    if a + b &lt;= c:
        return 'Impossible'
    if a != b != c:
        return 'Scalene'
    if a == c:
        return 'Equilateral'
    return 'Isosceles'

if __name__ == &quot;__main__&quot;:
    import doctest
    doctest.testmod()