I am currently learning Python and writing a simple code that includes: importing packages, input, output, while loop, loop termination, if conditional judgment, and two types of formatted strings.
import math
print("== --enter a radius to calculate the area-- ==")
num = input("please enter a radius :")
while True:
if num.isdigit():
r = float(num)
break
else:
print("{:s }not a number.".format(num))
r = input("please enter a number :")
s = math.pi * r ** 2
#format string
print("the radius is" + num + "the circle has an area of :" + str(round(s, 2)) + "。") #string concatenation
print("the radius is %s the circle has an area of :%.2f。" % (num, s)) #apply % operator
print("the radius is{ :s }the circle has an area of :{:.2f}。".format(num, s)) # format method
print(f"the radius is{ num }the circle has an area of :{s:.2f}。") # f string, Python3. added in version 6