函数必须用1个参数定义



我的代码按预期工作,但bot代码检查器显示一个错误"budget"函数应使用1个参数定义,我当前在定义中找到了0个参数"我试过想出多种解决方案,但都不起作用。

invited = input("Mitu kutsutud?: ")
coming = input("Mitu tuleb?: ")
food = 10
room = 55
def budget():
max_budget = 10 * int(kutsutud) + 55
min_budget = 10 * int(tuleb) + 55
print(str(max_budget) + " eurot")
print(str(min_budget) + " eurot")

budget()
invited = input("Mitu kutsutud?: ")
coming = input("Mitu tuleb?: ")
food = 10
room = 55
#This function needs 2 arguments assuming you are
#trying to use kutsutud and tuleb as the int values in your function
#This also assumes that min and max budget are unchanging
#Also the data above cannot be used because the exist before the function was created
def budget(exampleA,exampleB):
max_budget = 10 * int(kutsutud) + 55
min_budget = 10 * int(tuleb) + 55
print(str(max_budget) + " eurot")
print(str(min_budget) + " eurot")

budget()

##################################################################################

##Make your function here.
def budget(exampleA,exampleB):
max_budget = 10 * int(kutsutud) + 55
min_budget = 10 * int(tuleb) + 55
print(str(max_budget) + " eurot")
print(str(min_budget) + " eurot")

# Set Vars here
invited = input("Mitu kutsutud?: ")
coming = input("Mitu tuleb?: ")
food = 10
room = 55
#Call function here
budget(invited, coming)

希望根据我对这个问题的理解,这会有所帮助。

最新更新