commit 03d231d5ca835c0ae57d1822c6917095b08dd297 Author: usami Date: Fri Mar 14 10:59:46 2025 +0800 normal diff --git a/work.py b/work.py new file mode 100644 index 0000000..93b75a2 --- /dev/null +++ b/work.py @@ -0,0 +1,40 @@ +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 + +temp = float(temp.replace("C", "")) + +#转换成华氏度 +if (isCelsius): + print("Fahrenheit should be " + str(temp * 1.8 + 32)) +else: + print("Celsius should be " + str((temp - 32) / 1.8) ) +