In this video, I created a simple yet powerful Python program that calculates the square root of any number. It includes:
✅ User input handling
✅ Error checking using try-except
✅ Prevention of square root of negative numbers
✅ Looping until the user types "stop"
Perfect for Python beginners looking to understand user input, conditionals, and exception handling!
📌 Source Code:
while True:
num = input("Enter your number: ")
try:
if num.strip().lower() == "stop":
break
num = float(num)
if num is less than 0:
print("Cannot take square root of a negative number.")
else:
numsqrt = num ** 0.5
print(f"The square root of the number {num} is {numsqrt}")
except Exception as e:
print(f"Something went wrong: {e}")
🔔 Subscribe for more Python and Arduino projects!
#Python #PythonBeginner #PythonProject #SquareRootCalculator #TryExcept #LearnPython #RoboTechInnovate #CodingForBeginners #PythonTutorial
Nesta página do site você pode assistir ao vídeo on-line Python Square Root Calculator with Error Handling | Beginner Python Project duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário RoboTech Innovate 06 Abril 2025, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 24 vezes e gostou 0 espectadores. Boa visualização!