首页 新闻 赞助 找找看

求老师帮忙,这个程序select ,'t',结果不是15是21,为什么,而且重复执行‘t'

0
[已解决问题] 解决于 2017-06-22 20:17

def circle():
  r=input('please enter the radius of the circle:')
  area=3.14*r**2
  return area

def rectangle():
  l=input('please enter the length of the rectangle:')
  w=input('please enter the wide of the rectangle:')
  area=l*w
  return area

def triangle():
  l=input('please enter the length of triangle\'s bottm:')
  h=input('please enter the height of the triangle:')
  area=0.5*h*l
  return area

flag=True
while flag:
  print ('\n please to select C ,R,T, Q:')
  print ('c: circle')
  print ('R: rectangle')
  print ('T: triangle')
  print ('Q: quit')
  s=raw_input('Please enter the C,T,R,Q')
  if s=='c'or s=='C':
    area=circle()
  elif s=='r' or s=='Re':
    area=rectangle()
  elif s=='t' or s=='T':
    area=triangle()
  elif s=='q' or s=='Q':
  flag=False
  print ['the area is ', circle(),rectangle(),triangle()]

###程序运行截图

hh_ray的主页 hh_ray | 初学一级 | 园豆:200
提问于:2017-06-22 18:26
< >
分享
最佳答案
0

我也是醉了,粗心惹得祸,area=circle( )=rectagnle( )=triangle( )

hh_ray | 初学一级 |园豆:200 | 2017-06-22 20:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册