normal
This commit is contained in:
commit
03d231d5ca
40
work.py
Normal file
40
work.py
Normal file
@ -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) )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user