## Check if a rectangle is a square # reusable function def is_square(length, width): return length == width while True: length = input("Give me length of a rectangle: ") try: length = int(length) except: print('You have to type a number!') if type(length) is int: break while True: width = input("Give me width of a rectangle: ") try: width = int(width) except: print('You have to type a number!') if type(width) is not int: print('You have to type a number!') elif type(width) is int: break # Check if is square using function if is_square(length, width): print('It is a square!') else: print('It is not a square!')