(Sep-06-2020, 07:04 AM)ndc85430 Wrote:OK, is this "perfect" then ? :-)(Sep-06-2020, 06:55 AM)DPaul Wrote: I get an extra 'None' in the output.
Of course you do. On line 15, you assign the return value of the function tox
. The function referred to bybbb
(and in fact this is true for all your functions) has no return statement, therefore implicitly returnsNone
to its caller.
def AAA(): return 'AAAxxx' def BBB(): return 'BBByyy' def CCC(): return 'CCCzzz' aaa = AAA bbb = BBB ccc = CCC myDict = {100:aaa,200:bbb,300:ccc} x = myDict[200]() print(x)Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.