From the below code after submitting it as a coding test challenge. I used to get the following feedback from a robot or a bot that is marking the challenge that task() missing 1 required positional argument: 'name' but if I do run it on vs code it will print Hello Friend. And I don't know why. Please Clarify.
def task(name):
print("Hello", name + "!")
task("Friend")
Maybe they test task()
without an argument for name
. Try to set a default value like this
def task(name=""):
print("Hello", name + "!")
task("Friend") # Hello Friend!
task() # Hello !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.