import math
while True:
try:
number = float(input("Enter a number: "))
if number < 0:
print("Error: Cannot calculate the square root of a negative number.")
else:
square_root = math.sqrt(number)
print("The square root of", number, "is", square_root)
break # Exit the loop if successful
except ValueError:
print("Error: Invalid input. Please enter a valid number.")
aW1wb3J0IG1hdGgKCndoaWxlIFRydWU6CiAgICB0cnk6CiAgICAgICAgbnVtYmVyID0gZmxvYXQoaW5wdXQoIkVudGVyIGEgbnVtYmVyOiAiKSkKICAgICAgICBpZiBudW1iZXIgPCAwOgogICAgICAgICAgICBwcmludCgiRXJyb3I6IENhbm5vdCBjYWxjdWxhdGUgdGhlIHNxdWFyZSByb290IG9mIGEgbmVnYXRpdmUgbnVtYmVyLiIpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgc3F1YXJlX3Jvb3QgPSBtYXRoLnNxcnQobnVtYmVyKQogICAgICAgICAgICBwcmludCgiVGhlIHNxdWFyZSByb290IG9mIiwgbnVtYmVyLCAiaXMiLCBzcXVhcmVfcm9vdCkKICAgICAgICAgICAgYnJlYWsgICMgRXhpdCB0aGUgbG9vcCBpZiBzdWNjZXNzZnVsCiAgICBleGNlcHQgVmFsdWVFcnJvcjoKICAgICAgICBwcmludCgiRXJyb3I6IEludmFsaWQgaW5wdXQuIFBsZWFzZSBlbnRlciBhIHZhbGlkIG51bWJlci4iKQ==