Traceback (most recent call last): This is a running error .
Wrong background : Error in function call for multivalued parameter .
When I was practicing this problem , Use tuples as multivalued arguments to functions . When making function calls , There is a misuse of dictionary rules .
1. Dictionary key, You can't use "" contain .
2. Key value pairs are used in the middle = Not the comparison operator ==
It directly leads to the appearance of the top Traceback The reason for the mistake is , Undefined variable name used .
summary :debug Your ability needs to be proficient .
Attach error code :
def demo(num, *args, **kwargs): print(num) print(args) print(kwargs) print("") print(" The correct sample ") demo(1) demo(1, 2, 3,) demo(5, 6, 7, name=" Xiao Ming ", age=18) # Error model print(" demonstration 1, There is no definition in the code name This variable name , No... Was found during the comparison operation , Therefore, the program reports an error ") demo(5, 6, 7, name == " Xiao Ming ") print(" demonstration 2, The result of the comparison operation is a Boolean value ") demo(5, 6, 7, "name" == " Xiao Ming ")