Coverage for e10_sum_anything.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/bin/env python3
2"""Solution to chapter 3, exercise 10: mysum"""
5def mysum(*items):
6 """Sum the passed arguments, which should be of the same type.
7The arguments should handle the + operator.
8If passed no arguments, then return an empty tuple.
9"""
10 if not items:
11 return items
12 output = items[0]
13 for item in items[1:]:
14 output += item
15 return output