回复总数然后将其打印在输出中的模块化python有问题。帮一帮?return python
def main():
Monday = int(input("Enter the store sales for Monday: "))
Tuesday = int(input("Enter the store sales for Tuesday: "))
Wednesday = int(input("Enter the store sales for Wednesday: "))
Thursday = int(input("Enter the store sales for Thursday: "))
Friday = int(input("Enter the store sales or Friday: "))
total = totalSales()
print("the total sales for the week are:", total)
def totalSales(Monday, Tuesday, Wednesday, Thursday, Friday):
weeklyTotal = Monday + Tuesday + Wednesday + Thursday + Friday
return weeklyTotal
main()
错误消息:
Enter the store sales for Monday: 5
Enter the store sales for Tuesday: 4
Enter the store sales for Wednesday: 6
Enter the store sales for Thursday: 2
Enter the store sales or Friday: 8
Traceback (most recent call last):
File "so.py", line 16, in <module>
main()
File "so.py", line 8, in main
total = totalSales()
TypeError: totalSales() takes exactly 5 arguments (0 given)
也许,如果你说你的“麻烦”的性质,有人可以帮助你。 –
你还没有指定你的问题是什么。但我敢打赌,你面临的主要问题是你没有将所需的参数传递给'totalSales()'。看看你如何定义函数,并看看你是如何调用它。 – idjaw
即时尝试将总销售额中的所有销售总额加起来,然后将其返回 – vtecjustkickedinyo