def mul(*x):
if len(x)==0:
raise TypeError(‘hello world‘)
else:
for ii in x:
if not isinstance(ii,(int,float)):
raise TypeError(‘hello world‘)
n = 1
for i in x:
n = n*i
return n
print(mul())
import random
def get_name(n,*a):
if len(a)<n:
raise ValueError(‘n不能超过名单名字数‘)
a = list(a)
strs = ‘‘
for i in range(n):
name = a.pop(random.randrange(len(a)))
strs+=name+‘,‘
return strs.strip(‘,‘)
print(get_name(4,‘马大哈‘,‘王小明‘,‘张天宇‘,‘李明‘))