Discuss / Python / 交作业

交作业

Topic source

chengww5217

#1 Created at ... [Delete] [Delete and Lock User]
# -*- coding: utf-8 -*-
def product(x, *y):
    result = x
    for y1 in y:
        if not isinstance(y1, (int, float)):
            raise TyprError('Bad operand type: only int or float are allowed.')
        else:
            result *= y1
    return result

  • 1

Reply