您的位置:首页 > 编程语言 > Python开发

有三个数字,两个相同,输出那个不同的【不喜勿喷】

2017-06-29 15:30 465 查看
废话不多说,直接上代码,哪位朋友有其他写法,可以评论中分享出来。
#!/usr/bin/env python
#_*_ coding:utf-8 _*_
try:
def resu(a,b,c):
test = [a,b,c]
for i in range(3):
if i == 0:
if test[i] == test[i+1]:
print test[i+2]
exit()
if i == 1:
if test[i-1] == test[i+1]:
print test[i]
exit()
if i == 2:
if test[i] == test[i-1]:
print test[i-2]
exit()
if resu(80, 80,10):
print resu(80, 80,10)
else:
print "none"
except Exception as e:
print e
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python
相关文章推荐