要求用户输入T或S或R.如果输入的字符串为T,则打印公式 三角形的面积。如果输入的字符串是S,则打印区域的公式 广场。如果是R则打印矩形区域的公式。
答案 0 :(得分:0)
import os
while(True):
print('T: formula of the area of the triangle \n S: formula of the area of the square \n R: formula of the area of the rectangle \n')
x = raw_input('Enter your option: ')
if str(x.upper()) == 'T':
print "area = h*b/2 \n"
elif str(x.upper()) == 'S':
print "area = a*a \n"
elif str(x.upper()) == 'R':
print "area = w*l \n"
else:
print "Please enter a valied input \n"
你去吧