Jan-10-2019, 05:35 AM
I'm a newer to python, just have some simple format questions. Here is my code of creating a new function.
[python] >>> def make_complex(x,y):
... return{'y':y,'x':x}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]
and the second version is like this:
[python] >>> def make_complex(x,y):
... return{'x':x,'y':y,}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]
I found out that for the return part, I won't get the real order of what I define in the function. It turns out 'y' always be the first one to show up. Could anyone clear my confusion? Thanks.
[python] >>> def make_complex(x,y):
... return{'y':y,'x':x}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]
and the second version is like this:
[python] >>> def make_complex(x,y):
... return{'x':x,'y':y,}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]
I found out that for the return part, I won't get the real order of what I define in the function. It turns out 'y' always be the first one to show up. Could anyone clear my confusion? Thanks.