def flip_keys(to_flip):
"""To reverse items in a mixed list
Args:
to_flip(list): a list mixed with tuple and other values.
Returns:
list: to return values in the list, reversed.
Examples:
>>> flip_keys([(1, 2, 3), 'abc'])
'[(3, 2, 1), 'cba']
"""
counter = 0
for value in to_flip:
to_flip[counter] = value[::-1]
counter += 1
return to_flip
これは、入力された各要素を後方に反転させるためのPython関数です。私はインデックス作成を学んだが、to_flip [counter]は私が見たもののようなものではない。 to_flip [counter] serveは、各要素を反転させるのにどのような目的がありますか?これには名前がありますか?そして、与えられた数を足し合わせて和を出すのに役立ちませんか?それはなぜここに必要ですか?初心者のために、このような逆を行う方法は他にありますか?ありがとうございました。特定のPythonの逆関数の質問
https://docs.python.org/3/tutorial/introduction.html#lists –
'to_flip [counter]'は、 'counter'の位置にある' to_flip'リストの項目にアクセスします。 –
'flip_keys([(1、2、3)、 'abc'、1、3])'とは何でしょうか? – TigerhawkT3