while True: reply = input('Enter text:') if reply == 'stop': break elif reply.isdigit(): print(float(reply) ** 2) else: print('Invalid input')