9-码蹄集600题基础python篇
题目如上图所示。
这一题,没什么难度。
代码如下:
def main():#code here# x,a=map(int,input("").split(" "))# sum=((1/2)*(a*x+(a+x)/(4*a)))# print(f"{sum:.2f}")x,a=map(int,input().split())print(f"{((1/2)*(a*x+(a+x)/(4*a))):.2f}")if __name__ == '__main__':main();
代码中,注释的代码是第一遍做的。可以运行成功。
但是,需要注意,严格来说,不可以使用sum这种标识符定义。