求和+求平均
def foo():
def avg(seq):
return sum(seq)/len(seq)
zxc = input("Please input 3 nums with space lips: ").split(" ")
print("sum = %d, avg = %d" % (sum(zxc), avg(zxc)))
递归输出嵌套列表 ```python def foo(seq): for each in seq:
if isinstance(each, tuple):
foo(each)
else:
print(each)
zxc = [‘jack’, (‘tom’, 23), ‘rose’, (14, 55, 67)] foo(zxc)
3. 排序
```python
zxc = [{'name': 'qian', 'age': 28}, {'name': 'an', 'age': 20}, {'name': 'james', 'age': 25}]
print(sorted(zxc, key=lambda x: x['name']))