這是我的代碼:如何處理錯誤的輸入(輸入非數字值)?
def calc_area(radius):
return (radius **2) * (math.pi)
def calc_circ (radius):
return (math.pi * radius) * 2
radius = float(input('Please enter the cirlcle\'s radius: '))
print ('The area of the the circle is', calc_area(radius), 'and the circumference is', calc_circ(radius))
我能做些什麼,以確保用戶不會鍵入一個字母?