はじめに
この実験では、Python で文字列が回文 (palindrome) かどうかをチェックする方法を学びます。回文とは、「madam」や「racecar」のように、前から読んでも後ろから読んでも同じになる文字の並びのことです。
この実験では、回文を識別する is_palindrome
関数を定義する Python スクリプトを作成する手順を案内します。これには、入力テキストを小文字に変換し、空白を削除してから、処理されたテキストをその逆順のバージョンと比較することが含まれます。また、サンプルの単語を使って関数をテストする方法も学びます。
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
python(("Python")) -.-> python/BasicConceptsGroup(["Basic Concepts"])
python(("Python")) -.-> python/ControlFlowGroup(["Control Flow"])
python(("Python")) -.-> python/FunctionsGroup(["Functions"])
python(("Python")) -.-> python/AdvancedTopicsGroup(["Advanced Topics"])
python/BasicConceptsGroup -.-> python/strings("Strings")
python/ControlFlowGroup -.-> python/conditional_statements("Conditional Statements")
python/FunctionsGroup -.-> python/function_definition("Function Definition")
python/AdvancedTopicsGroup -.-> python/regular_expressions("Regular Expressions")
subgraph Lab Skills
python/strings -.-> lab-559574{{"Python で文字列が回文かどうかをチェックする方法"}}
python/conditional_statements -.-> lab-559574{{"Python で文字列が回文かどうかをチェックする方法"}}
python/function_definition -.-> lab-559574{{"Python で文字列が回文かどうかをチェックする方法"}}
python/regular_expressions -.-> lab-559574{{"Python で文字列が回文かどうかをチェックする方法"}}
end