# coding: UTF-8
"""
-通过键盘输入数字,作为圆的半径
-计算圆的周长和面积,并分别打印显示出来,结果保留两位小数
知识点:
1、键盘输入方法,输入的类型为字符串,如果要做运算,需要把字符串转换成整数或者浮点数
2、math模块的pi方法
3、保留小数位数的方法,round()
注意:变量名尽量不要用l , o , I 来作为变量名,因为这些字符比较容易和数字1,0混淆
获取用户输入的时候要进行判断这个存在的问题在后面练习中再体现
"""
import math
r = input("please input r:")
R = float(r)
circle = 2*math.pi*R
area = math.pi*(R**2)
print('The circle is {}'.format(round(circle, 2)))
print('The area is {}'.format(round(area, 2)))
# coding :UTF-8
"""
题目
-询问用户姓名和年龄
-计算10年之后的年龄
-打印出用户的姓名,及其现在和10年后的年龄
知识点:
1、format方法的使用:格式化输出
2、换行打印
"""
name = input("please input your name:")
age = input("please input your age:")
age = int(age)
age_after10 = age + 10
print("your name is {}".format(name))
print("now you are {} yeas old".format(age))
print("after 10 years later,you are {} years old".format(age_after10))
print("your name is {0}. \nyou are {1} years old now. \nyou are {2} years old after ten yeas later".format(name, age, age_after10))