数学家可能会立即理解名为gcd()的函数返回两个数字的最大公分母,但其他人会发现getGreatestCommonDenominator()提供的信息更多。 切记不要使用 Python 的任何内置函数或模块名称,如all、any、date、email、file、format、hash、id、input、list、min、max、object、open、random、set、str、sum、test和type。 函数大小...
"""Prompt the player, and return which towers they select.""" print('Enter the letters of "from" and "to" towers, or QUIT.') print("(e.g. AB to moves a disk from tower A to tower B.)") print() return input("> ").upper().strip() def terminateIfResponseIsQuit(response): ...
defaskForPlayerMove():"""Prompt the player, and return which towers they select."""print('Enter the letters of "from" and "to" towers, or QUIT.')print("(e.g. AB to moves a disk from tower A to tower B.)")print()returninput("> ").upper().strip()defterminateIfResponseIsQuit(...