如下即可,你这代码里存在2个主要问题,1.输入方式,2.输入格式
while True:
s = raw_input("Please enter 3 integers to combine a triangle(enter q to quit):")
S = s.split(',')
if s == 'q':
break
else:
a=int(S[0])
b=int(S[1])
c=int(S[2])
if a+b>c and a+c>b and b+c>a:
if a==b and b==c:
print "It's a regular triangle."
else:
if a==b or b==c or a==c:
print "It's an isosceles triangle."
else:
print "It's a normal triangle."
else:
print 'Sorry, the 3 numbers cannot combine a triangle.'
print 'The end.'
和你输入的s值有关系吧,这个值是个字符串,你分别取到的a,b,c也是字符串,需要转化成int。
a=int(s[0])
b=int(s[1])
c=int(s[2])
把a b c 变量进行类型转换成整型试试