赞
踩
# 请在此添加代码
########## Begin ##########
def convert(c):
f=1.8*c+32
return f
########## End ##########
C = eval(input( "input a number:" ))
F = convert( C )
print( "%.1f"%F )
# 请在此添加代码 from math import * ########## Begin ########## # 计算三角形的面积 def ts(a,b,c): s = (a + b + c) / 2 area = sqrt(s * (s - a) * (s - b) * (s - c)) return area # 主函数 def main(): k1, k2, k3, k4, k5, k6, k7 = map(int, input().split(',')) a1 = k1 b1 = k2 c1 = k6 a2 = k3 b2 = k7 c2 = k6 a3 = k5 b3 = k4 c3 = k7 area = ts(a1, b1, c1) + ts(a2, b2, c2) + ts(a3, b3, c3) print("area=%.5f" % area) ########## End ########## main()
# 请在此添加代码
from math import *
########## Begin ##########
f=lambda n:(1+log(n,e))/(2*pi) #请补充完整lambda函数
########## End ##########
n=int(input("Please Input n:"))
y=exp(2.0)
for n in range(1,n+1):
y+=f(n)
print('y=%.5f'%y)
# 请在此添加代码 ########## Begin ########## def mysum(n,m): res = 0 for i in range(1, n+1): res += i**m return res def main(): n = int(input("Please Input n:")) if n % 10 != 0: print("input error") else: sum1 = mysum(n, 1) sum2 = mysum(n//2, 2) sum3 = mysum(n//10,-1) s = sum1 + sum2 + sum3 print('s=%.5f'%s) ########## End ########## main() #调用main实现求和
# 请在此添加代码
########## Begin ##########
def p(x,n): #函数定义
if n==1:
return x
else:
return x*(1-p(x,n-1))
########## End ##########
x,n=eval(input("请依次输入x,n的值:"))
s=p(x,n)
print("p(%f,%d)=%.2f"%(x,n,s))
def isprime(n): if n < 2: return False for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True def main(): a = int(input("please input a:")) b = int(input("please input b:")) count = 0 if (a < 0 or b < 0 or a <= b): print("Input Error") else: ##以下为求出满足条件的分数的个数 for m in range(1, 100): if isprime(m) : # 固定分子,分母进行遍历 for n in range(10, 100): if isprime(n) : x = m / n if x >= 1 / a and x <= 1 / b: count += 1 print("满足条件的数有{}个".format(count)) main()
第六关如果先固定分母不知道为什么过不了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。