#create function
def print_something(arg1, arg2):
print("arg1 =>", arg1)
print("arg2 =>", arg2)
# now you need to call it
print_something("spam", "eggs") # this will print "arg1 => spam", "arg2 => eggs"
# if you call print_something() you ll get Error because you didnt give any arguments and declared the functions with arguments
创建函数后忘记调用它:
你需要的只是简单的称呼它
您创建了一个带有参数的函数,这意味着当您调用它时,需要为它提供参数
示例:
相关问题 更多 >
编程相关推荐