pythonwork/work.py

45 lines
850 B
Python

import math
u = float(input('Usual: \n'))
f = float(input('Final Exam: \n'))
c = u * 40 + f * 60
total = c / 100
print(f"Final Grade: {total:.2f}")
a = float(input('A \n'))
b = float(input('B \n'))
c = float(input('C \n'))
if (a + b > c) and (a + c > b) and (b + c > a):
length = a + b + c
print("周长 " + str(length))
s = length / 2
area = math.sqrt(s * (s - a) * (s - b) * (s - c))
print("面积 " + str(area))
else:
print("无效的三角形三边")
temp = input("TEMP INPUT \n")
isCelsius = False
if str(temp).__contains__("C"):
isCelsius = True
if isCelsius:
temp = float(temp.replace("C", ""))
else:
temp = float(temp.replace("F", ""))
#转换成华氏度
if isCelsius:
print("Fahrenheit should be " + str(temp * 1.8 + 32))
else:
print("Celsius should be " + str((temp - 32) / 1.8) )