s = input("実数を入力して下さい:") try: f = float(s) print(f"{f}の2乗は{f**2}です!") except ValueError: print(f"{s}は実数を表しません……") # プログラム10-6(ValueErrorを扱う)