def average(tup):
""" ugiufh """
total = ((int(tup[0]) + int(tup[1]) + int(tup[2]))/3,
(int(tup[0]) + int(tup[1]) + int(tup[2]))/3,
(int(tup[0]) + int(tup[1]) + int(tup[2]))/3)
return total
我写一个函数来平均3种元素中的元组,这意味着如果原始元组=(1,2,3),其给我元组=(2,2,2)如何浓缩此功能?
我的问题有没有什么办法来压缩写给我的答案?如果是,如何浓缩它?
感谢
删除'“”“ugiufh”“”'' - 一行较小。 :) – James 2011-03-10 17:19:48
你确定你想在这里做整数除法吗?就一个问题。 – 2011-03-10 17:25:47
不要删除它,而是在文档字符串中描述函数 – joaquin 2011-03-10 17:25:55