+ 2
Can anyone explain this code.
def h(x:str,n:str)-> str: return h.__annotations__ print(h('a','b')['m']) can anyone explain me that how this function works.
1 Réponse
+ 3
Function h has 2 parameters, x and n. x and n are both strings. When executed h looks at all parameters of h and returns a dictionary. The keys of the dict are the parameter names, and 'return' for the return annotation, if provided.
Note: I had to remove ['m'] in order for the program to execute properly.