python计算梯形⾯积_Python代码分享:⾯积计算器3.0代码分享代码:(⾯积计算器3.0)
print("There is Calculator, It's Loading.")
import sys
import time
def Cus_precess(max_tep):
for i in range(1,max_tep):
print ('['+'|'*i+' '*(max_tep-i)+']'+str(int(100/(max_tep-1)*i))+'%'+'\r',end=''+'Loading File:')
time.sleep(0.1)
print ('\n')
def main():
max = 100
Cus_precess(max)
if __name__ == '__main__':
main()
print("Switching from English to Chinese.")
def Cus_precess(max_tep):
for i in range(1,max_tep):
print ('['+'|'*i+' '*(max_tep-i)+']'+str(int(100/(max_tep-1)*i))+'%'+'\r',end=''+'Switching from English to Chinese:')
time.sleep(0.1)
print ('\n')
def main():
python新手代码你好max = 100
Cus_precess(max)
if __name__ == '__main__':
main()
print("准备就绪。")
print("你好,这是⾯积计算器3.1。\n平⾏四边形/长⽅形输⼊1,正⽅形输⼊2,三⾓形输⼊3,梯形输⼊4,圆形输⼊5。")
while True:
a = input("退出输⼊(TC)\n请输⼊:")
if a == '1':
q = int(input("长是:"))
w = int(input("宽/⾼是:"))
e = q*w
print("⾯积是:" , e)
elif a == '2':
r =int(input("边长是:"))
t = r**2
print("⾯积是:" , t)
elif a == '3':
y = int(input("底是:"))
u = int(input("⾼是:"))
i = y*u/2
print("⾯积是:" , i)
elif a == '4':
o = int(input("上底是:"))
p = int(input("下底是:"))
d = int(input("⾼是:"))
s = (o+p)*d/2
print("⾯积是:" , s)
elif a == '5':
f = 3.1415926535
g = int(input("半径是:"))
h = g**2*f
print("⾯积是:" , h)
print("(精度:派=3.1415926535)")
elif a == 'TC':
exit()
else:
print("⽆法计算,请再输⼀次(平⾏四边形/长⽅形输⼊1,正⽅形输⼊2,三⾓形输⼊3,梯形输⼊4,圆形输⼊5,退出计算输⼊‘TC’)")
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论