常用内置函数的使用
import math
def func1():
a, b = eval(input("input a,b:")) # 计算并返回ab的值
res = divmod(a, b) #返回包含整商和余数的元组((x-x%y)/y,x%y)
print('{0[0]}, {0[1]}'.format(res))
#print(res)
def func2(): #计算输出名字所占字节数长度
name = input("input your name:")
print(len(name))
def func3(): #有问题
pi = 3.14
h, r = eval(input())
v = h * pi * r ** 2 #计算圆柱的体积
d, m = divmod(20, v)
if m:
print('{}'.format(int(d + 1)))
else:
print(d)
def func4():
x1, y1 = eval(input("x1,y1"))
x2, y2 = eval(input("x2,y2"))
dis = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
print(dis)
#随机函数
def func5():
import random
num = random.randint(100, 999)
print(num)
s = str(num)
s2 = ''.join(reversed(s))
print(s2)
if __name__ == "__main__":
# func1()
# func2()
func3()
# func4()
# func5()