如何在除法函数中将每个元素除以下一个元素?我在调用函数中传递任意参数。提前致谢。
def add(*number):
numm = 0
for num in number:
numm =num+numm
return numm
def subtract(*number):
numm = 0
for num in number:
numm = num-numm
return numm
def division(*number):
#i am facing problem here
# numm = 1
# for num in number:
try:
if (z>=1 and z<=4):
def get_input():
print('Please enter numbers with a space seperation...')
values = input()
listOfValues = [int(x) for x in values.split()]
return listOfValues
val_list = get_input()
if z==1:
print("Addition of numbers is:", add(*val_list))
elif z==2:
print("Subtraction of numbers is:", subtract(*val_list))
elif z==3:
print("division of numbers is:", division(*val_list))